Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Complex query and pagination #38

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

kemal-bay
Copy link

In order to make a proper pagination, I added a function called complexSearchAndPaginate to trait file.
Issue #33

@timgws
Copy link
Member

timgws commented Feb 22, 2016

Looks good to me, thanks @kemal-bay!

Before merging this, I want to place some notes in the documentation specifically about doing efficient searching in Elasticsearch. During working on this project, I am noticing that many people are not really coming from an Elasticsearch background.

This is not specifically a bad thing, however, people may not be aware of the setbacks of using specific methods, and what problems may arise from using them incorrectly.

We should attach a warning on the search functions in the README.md similar to what is in the Elasticsearch guide (https://www.elastic.co/guide/en/elasticsearch/guide/current/pagination.html).

Now imagine that we ask for page 1,000—results 10,001 to 10,010. Everything works in the same way except that each shard has to produce its top 10,010 results. The coordinating node then sorts through all 50,050 results and discards 50,040 of them!

You can see that, in a distributed system, the cost of sorting results grows exponentially the deeper we page. There is a good reason that web search engines don’t return more than 1,000 results for any query.

I think that if people are just dropping Elasticsearch into their Laravel applications without much ES-specific knowledge, we should do our part to 'educate' developers using this module about possible setbacks and warnings for implementations.

@szente
Copy link

szente commented May 25, 2016

@timgws please merge this commit, pagination doesn't work at the moment

@timgws
Copy link
Member

timgws commented May 26, 2016

@szente, I will merge this, as soon as the functionality has been put into the readme file, and the warning put in as per the request I made in February.

Feel free to add another PR for adding the note in the README file, but until that has been done, this will not be merged.

@huglester
Copy link

hello @timgws pagination is not accurate.
Can you please exmplain how then to return ie < 1000 results and paginate them 'correctly' ?

Thank you

Copy link

@mheni mheni left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i want to know how you called the pagination function into the view? @kemal-bay

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants