You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by Shayan Haque <me...@shyyawn.com> on 2015/09/03 04:01:07 UTC

Position of Document in Listing (Search Result)

Hi,

I need to get a document position within a search result for a specific
member, to show them where there result lie for a particular set of
filters... I tried using a Solr-Ranking plugin but its outdated, version
3.5 compatible. Is there some other way?
Ordinal ranking or any other thing.. the version I am using is solr 4.7.
The last resort would be counting in the app.. but the issue is that would
be extensive... it would mean running a Solr request for each listed item
to get its position by looping through the results till X page or X limit
... can't traverse all data.

Help plz.


-Shayan

Re: Position of Document in Listing (Search Result)

Posted by Shayan Haque <me...@shyyawn.com>.
Sure,

An example query with sorting and all would be something like as follow.

http://192.168.21.34/solr/idx_pub/select?q=bump:true^100 featured:true^10
(*:*)^1&fq=make_search:honda&fq=model_search:beat&fq=price:[* TO
*]&fq=price_drop:[* TO *]&fq=price_drop_percentage:[* TO *]&fq=year:[* TO
*]&fq=mileage:[* TO
*]&facet=true&facet.mincount=1&facet.field=make&facet.field=model&facet.field=model_group&facet.field=series&facet.field=variant&facet.field=state&facet.field=area&facet.field=city&facet.field=suburb&facet.field=type&facet.field=vehicle_type&facet.field=transmission&facet.field=profile_type&facet.field=assemble_type&facet.field=color&facet.field=body&facet.field=nickname_label&start=0&rows=500&sort=score
desc,bump_date_search desc&wt=json&json.nl
=map&omitHeader=true&fl=*,score&facet.limit=-1



PS: Sorry for the late reply.

-
Kind Regards,
Shayan



On Fri, Sep 4, 2015 at 4:57 AM Alexandre Rafalovitch <ar...@gmail.com>
wrote:

> That's a good point. What is the query sorting on?
>
> Shayan, can you give an example of a query with sorting/etc shown.
>
> Regards,
>    Alex.
> ----
> Solr Analyzers, Tokenizers, Filters, URPs and even a newsletter:
> http://www.solr-start.com/
>
>
> On 3 September 2015 at 16:24, Chris Hostetter <ho...@fucit.org>
> wrote:
> >
> > : Write a PostFilter which takes in a document id. It lets through all
> > : documents until it sees that document id. Once it sees it, it stops
> > : letting them through.
> > :
> > : Thus, the total count of documents would be the position of your
> queried
> > : car.
> >
> > Sorry guys, that won't work.
> >
> > PostFilter's can be used to collect & filter the documents returned as
> the
> > result of a query, after the main query logic (so you can delay expensive
> > filter checks) but they still happen before any sorting -- they have to
> in
> > order to in order for the sorting logic to know *whic* documents
> > should be added to the priority queue.
> >
> >         - - -
> >
> > I can only think of two appraoches to this general problem:
> >
> > 1) 2 queries with frange filter on score.
> >
> > this solution is only applicable in situations where:
> >   a) you are only sorting on scores
> >   b) the position information can be aproximate as far as other docs with
> > identical scores (ie: you can say "X documents have a higher score"
> > instead of "exactly X documents come before this one")
> >
> > The key is to first do a query on whever where you filter (fq) on the doc
> > id(s) you are interested in so you can get them back along with the
> > scores, then you do another query where you do something like...
> >
> > ?rows=0&q=whatever&fq={!frange incl=false l=THE_SCORE v=$q}
> >
> > ...so that you post filter and ignore any doc that doesn't have a higher
> > score and look at hte total numFound.
> >
> > if there are multiple docs you need to get info about at one time,
> instead
> > of filtering you can use facet.query the same way
> >
> >   rows=0
> >   q=whatever
> >   facet=true
> >   facet.query={!frange key=doc1 incl=false l=DOC1_SCORE v=$q}
> >   facet.query={!frange key=doc2 incl=false l=DOC2_SCORE v=$q}
> >   facet.query={!frange key=doc3 incl=false l=DOC3_SCORE v=$q}
> >   ...etc...
> >
> >
> https://cwiki.apache.org/confluence/display/solr/Other+Parsers#OtherParsers-FunctionRangeQueryParser
> >
> > 2) cursor deep paging
> >
> > this solution will work regardless of the number of docs you are
> > interested in, and regardless of how complex your sort options are --
> just
> > use the cursorMark param to iterate over all the results in your client
> > until you've found all the unqiueKeys you are looking for, counting the
> > docs found as you go.
> >
> > The various docs on deep paging and using cursors go into some background
> > hwich may help you understand why what you are asking for in general is a
> > hard problem, and why suggestion #1 only works with a simple sort on
> > score, and for anything more complex you really have to go the cursor
> > route...
> >
> > https://cwiki.apache.org/confluence/display/solr/Pagination+of+Results
> >
> https://lucidworks.com/blog/coming-soon-to-solr-efficient-cursor-based-iteration-of-large-result-sets/
> >
> > -Hoss
> > http://www.lucidworks.com/
>
-- 

Kind Regards,
Shayan

Re: Position of Document in Listing (Search Result)

Posted by Alexandre Rafalovitch <ar...@gmail.com>.
That's a good point. What is the query sorting on?

Shayan, can you give an example of a query with sorting/etc shown.

Regards,
   Alex.
----
Solr Analyzers, Tokenizers, Filters, URPs and even a newsletter:
http://www.solr-start.com/


On 3 September 2015 at 16:24, Chris Hostetter <ho...@fucit.org> wrote:
>
> : Write a PostFilter which takes in a document id. It lets through all
> : documents until it sees that document id. Once it sees it, it stops
> : letting them through.
> :
> : Thus, the total count of documents would be the position of your queried
> : car.
>
> Sorry guys, that won't work.
>
> PostFilter's can be used to collect & filter the documents returned as the
> result of a query, after the main query logic (so you can delay expensive
> filter checks) but they still happen before any sorting -- they have to in
> order to in order for the sorting logic to know *whic* documents
> should be added to the priority queue.
>
>         - - -
>
> I can only think of two appraoches to this general problem:
>
> 1) 2 queries with frange filter on score.
>
> this solution is only applicable in situations where:
>   a) you are only sorting on scores
>   b) the position information can be aproximate as far as other docs with
> identical scores (ie: you can say "X documents have a higher score"
> instead of "exactly X documents come before this one")
>
> The key is to first do a query on whever where you filter (fq) on the doc
> id(s) you are interested in so you can get them back along with the
> scores, then you do another query where you do something like...
>
> ?rows=0&q=whatever&fq={!frange incl=false l=THE_SCORE v=$q}
>
> ...so that you post filter and ignore any doc that doesn't have a higher
> score and look at hte total numFound.
>
> if there are multiple docs you need to get info about at one time, instead
> of filtering you can use facet.query the same way
>
>   rows=0
>   q=whatever
>   facet=true
>   facet.query={!frange key=doc1 incl=false l=DOC1_SCORE v=$q}
>   facet.query={!frange key=doc2 incl=false l=DOC2_SCORE v=$q}
>   facet.query={!frange key=doc3 incl=false l=DOC3_SCORE v=$q}
>   ...etc...
>
> https://cwiki.apache.org/confluence/display/solr/Other+Parsers#OtherParsers-FunctionRangeQueryParser
>
> 2) cursor deep paging
>
> this solution will work regardless of the number of docs you are
> interested in, and regardless of how complex your sort options are -- just
> use the cursorMark param to iterate over all the results in your client
> until you've found all the unqiueKeys you are looking for, counting the
> docs found as you go.
>
> The various docs on deep paging and using cursors go into some background
> hwich may help you understand why what you are asking for in general is a
> hard problem, and why suggestion #1 only works with a simple sort on
> score, and for anything more complex you really have to go the cursor
> route...
>
> https://cwiki.apache.org/confluence/display/solr/Pagination+of+Results
> https://lucidworks.com/blog/coming-soon-to-solr-efficient-cursor-based-iteration-of-large-result-sets/
>
> -Hoss
> http://www.lucidworks.com/

Re: Position of Document in Listing (Search Result)

Posted by Chris Hostetter <ho...@fucit.org>.
: Write a PostFilter which takes in a document id. It lets through all
: documents until it sees that document id. Once it sees it, it stops
: letting them through.
: 
: Thus, the total count of documents would be the position of your queried
: car.

Sorry guys, that won't work.

PostFilter's can be used to collect & filter the documents returned as the 
result of a query, after the main query logic (so you can delay expensive 
filter checks) but they still happen before any sorting -- they have to in 
order to in order for the sorting logic to know *whic* documents 
should be added to the priority queue.

	- - -

I can only think of two appraoches to this general problem: 

1) 2 queries with frange filter on score.

this solution is only applicable in situations where:
  a) you are only sorting on scores
  b) the position information can be aproximate as far as other docs with 
identical scores (ie: you can say "X documents have a higher score" 
instead of "exactly X documents come before this one")

The key is to first do a query on whever where you filter (fq) on the doc 
id(s) you are interested in so you can get them back along with the 
scores, then you do another query where you do something like...

?rows=0&q=whatever&fq={!frange incl=false l=THE_SCORE v=$q}

...so that you post filter and ignore any doc that doesn't have a higher 
score and look at hte total numFound.

if there are multiple docs you need to get info about at one time, instead 
of filtering you can use facet.query the same way

  rows=0
  q=whatever
  facet=true
  facet.query={!frange key=doc1 incl=false l=DOC1_SCORE v=$q}
  facet.query={!frange key=doc2 incl=false l=DOC2_SCORE v=$q}
  facet.query={!frange key=doc3 incl=false l=DOC3_SCORE v=$q}
  ...etc...

https://cwiki.apache.org/confluence/display/solr/Other+Parsers#OtherParsers-FunctionRangeQueryParser

2) cursor deep paging

this solution will work regardless of the number of docs you are 
interested in, and regardless of how complex your sort options are -- just 
use the cursorMark param to iterate over all the results in your client 
until you've found all the unqiueKeys you are looking for, counting the 
docs found as you go.

The various docs on deep paging and using cursors go into some background 
hwich may help you understand why what you are asking for in general is a 
hard problem, and why suggestion #1 only works with a simple sort on 
score, and for anything more complex you really have to go the cursor 
route...

https://cwiki.apache.org/confluence/display/solr/Pagination+of+Results
https://lucidworks.com/blog/coming-soon-to-solr-efficient-cursor-based-iteration-of-large-result-sets/

-Hoss
http://www.lucidworks.com/

Re: Position of Document in Listing (Search Result)

Posted by Upayavira <uv...@odoko.co.uk>.
Here's the way to do it, based on Alexandre's idea:

Write a PostFilter which takes in a document id. It lets through all
documents until it sees that document id. Once it sees it, it stops
letting them through.

Thus, the total count of documents would be the position of your queried
car.

Then, you do a q=make:toyota&fq={!mypostfilter id=12345}&rows=0

This simply tells Solr to return a numFound value (your required
position) whilst ignoring the actual documents themselves.

This would, I reckon, be as performant as a search for q=make:toyota and
wouldn't require too much coding.

Upayavira
 
On Thu, Sep 3, 2015, at 05:28 PM, Alexandre Rafalovitch wrote:
> So, basically for each car, you want to generate a query with the same
> parameter (e.g. make) and then say where in the results for that
> query, your particular car would be. Right?
> 
> I think the only way is to run the query and to see where the car is
> in the result. So, a custom code of some sort. But you don't have to
> do it in the Client.
> 
> You could do it in a Solr PostFilter and basically do the count there
> and just not return anything while - somehow - injecting the count
> into the results (maybe via custom search module).
> http://www.solr-start.com/javadoc/solr-lucene/org/apache/solr/search/PostFilter.html
> 
> Or maybe in a custom search module, though I suspect that's harder and
> more expensive.
> 
> Or enable lazy-loading and request only Id fields to make it cheaper
> to iterate through larger query on the client (possibly with a cursor
> mark).
> 
> Hope some of these help.
> 
> Regards,
>    Alex.
> ----
> Solr Analyzers, Tokenizers, Filters, URPs and even a newsletter:
> http://www.solr-start.com/
> 
> 
> On 3 September 2015 at 11:57, Erick Erickson <er...@gmail.com>
> wrote:
> > OK, but how are they ordered on the public pages? I'm guessing
> > that what I'm missing here is something like
> > "If I did an identical search on the public pages, my car would be
> > number 208" _Something_ has to glue the two separate pages
> > together.
> >
> > If it's something like that I don't see a good way to handle it. The
> > position of the member's car on the public page sounds like
> > it changes by query, i.e. if the search is "blue chevy" cars then
> > the position would be different than just "chevy".
> >
> > Even if it were a static ranking, by the time you tried to make static
> > lists for all the combinations it'd be a nightmare if it was do-able at
> > all.
> >
> > Don't see a clean way to do this off the top of my head.
> >
> > Best,
> > Erick
> >
> > On Wed, Sep 2, 2015 at 11:44 PM, Shayan Haque <me...@shyyawn.com> wrote:
> >> Let me give an example: for suppose we have "public pages" which list cars
> >> for makes (they use  q=make:Chery  or   q=make:Toyota etc...) and list cars
> >> for all members.
> >>
> >> Now suppose, in our member account area, there is already a page that lists
> >> cars that the current logged in member had posted. In this listing, we'd
> >> like to add, that where on the public pages his published cars shows. So if
> >> a member posted a Toyota Car or Honda Car, it should show your posted
> >> Toyota Car 1 is shown on 208th 'position' on public page  /toyota/. The
> >> public page shows 10 cars per page so that would make it the 21st page but
> >> page number is easy to calculate if the position is know.
> >>
> >> Hope this clears it a bit.
> >>
> >>
> >>
> >>
> >>
> >>
> >>
> >>
> >>
> >>
> >> On Thu, Sep 3, 2015 at 1:39 PM Erick Erickson <er...@gmail.com>
> >> wrote:
> >>
> >>> It's entirely unclear what you mean by "position".
> >>>
> >>> bq:  where for "make and model" his
> >>> first result comes
> >>>
> >>> Comes in what? The search result list? Some
> >>> a-priori ordering of all the cars that has
> >>> nothing to do with this search? The results
> >>> list of everyone's cars that have the same
> >>> make and model? If this latter, what good
> >>> is this doing the user? On what criteria
> >>> are the make/model combination ordered so
> >>> that the position of the user's car has
> >>> meaning?
> >>>
> >>>  Some concrete examples would help I think.
> >>>
> >>> Best,
> >>> Erick
> >>>
> >>>
> >>> On Wed, Sep 2, 2015 at 9:42 PM, Shayan Haque <me...@shyyawn.com> wrote:
> >>> > Thanks for the reply Erick.
> >>> >
> >>> > How do I get the position? I am searching on e.g. car model and make,
> >>> and I
> >>> > want to show on which position the members's first car falls for that
> >>> > specific car model and make. So I tell solr, get listing for the cars
> >>> with
> >>> > the model and make. I want from that result, if the member's first result
> >>> > is 208th document, could be 2008th.
> >>> >
> >>> > Well the web interface that I need to implement is different though. In
> >>> > actual the member will see all his cars with where for "make and model"
> >>> his
> >>> > first result comes. If I get the above thing to work, I'd basically
> >>> search
> >>> > solr for each of his car's make and model. It will be 12 or 24 cars per
> >>> > page, so it's not the best solution but still better if solr can give the
> >>> > position. Alternate would be to I have to loop all the results pr solr
> >>> > search, that would be even worse, 12 * 10000+ results. I may even have
> >>> > limit the search to 1000 positions per make and model or some other cap
> >>> and
> >>> > show user not the exact position if not found in the 1000 result.
> >>> >
> >>> >
> >>> > Maybe I am not thinking in the right direction using Solr for this. Can't
> >>> > think how I'd get the position any other way as the site's public pages
> >>> use
> >>> > solr for listing.
> >>> >
> >>> >
> >>> >
> >>> > -
> >>> > Regards,
> >>> > Shayan
> >>> >
> >>> >
> >>> >
> >>> >
> >>> >
> >>> >
> >>> >
> >>> >
> >>> >
> >>> >
> >>> > On Thu, Sep 3, 2015 at 12:08 PM Erick Erickson <er...@gmail.com>
> >>> > wrote:
> >>> >
> >>> >> Well, you have access to the start parameter, isn't it just
> >>> >> start+(ordinal position in the page)?
> >>> >>
> >>> >> Best,
> >>> >> Erick
> >>> >>
> >>> >> On Wed, Sep 2, 2015 at 7:01 PM, Shayan Haque <me...@shyyawn.com> wrote:
> >>> >> > Hi,
> >>> >> >
> >>> >> > I need to get a document position within a search result for a
> >>> specific
> >>> >> > member, to show them where there result lie for a particular set of
> >>> >> > filters... I tried using a Solr-Ranking plugin but its outdated,
> >>> version
> >>> >> > 3.5 compatible. Is there some other way?
> >>> >> > Ordinal ranking or any other thing.. the version I am using is solr
> >>> 4.7.
> >>> >> > The last resort would be counting in the app.. but the issue is that
> >>> >> would
> >>> >> > be extensive... it would mean running a Solr request for each listed
> >>> item
> >>> >> > to get its position by looping through the results till X page or X
> >>> limit
> >>> >> > ... can't traverse all data.
> >>> >> >
> >>> >> > Help plz.
> >>> >> >
> >>> >> >
> >>> >> > -Shayan
> >>> >>
> >>>
> >> --
> >>
> >> Kind Regards,
> >> Shayan

Re: Position of Document in Listing (Search Result)

Posted by Alexandre Rafalovitch <ar...@gmail.com>.
So, basically for each car, you want to generate a query with the same
parameter (e.g. make) and then say where in the results for that
query, your particular car would be. Right?

I think the only way is to run the query and to see where the car is
in the result. So, a custom code of some sort. But you don't have to
do it in the Client.

You could do it in a Solr PostFilter and basically do the count there
and just not return anything while - somehow - injecting the count
into the results (maybe via custom search module).
http://www.solr-start.com/javadoc/solr-lucene/org/apache/solr/search/PostFilter.html

Or maybe in a custom search module, though I suspect that's harder and
more expensive.

Or enable lazy-loading and request only Id fields to make it cheaper
to iterate through larger query on the client (possibly with a cursor
mark).

Hope some of these help.

Regards,
   Alex.
----
Solr Analyzers, Tokenizers, Filters, URPs and even a newsletter:
http://www.solr-start.com/


On 3 September 2015 at 11:57, Erick Erickson <er...@gmail.com> wrote:
> OK, but how are they ordered on the public pages? I'm guessing
> that what I'm missing here is something like
> "If I did an identical search on the public pages, my car would be
> number 208" _Something_ has to glue the two separate pages
> together.
>
> If it's something like that I don't see a good way to handle it. The
> position of the member's car on the public page sounds like
> it changes by query, i.e. if the search is "blue chevy" cars then
> the position would be different than just "chevy".
>
> Even if it were a static ranking, by the time you tried to make static
> lists for all the combinations it'd be a nightmare if it was do-able at
> all.
>
> Don't see a clean way to do this off the top of my head.
>
> Best,
> Erick
>
> On Wed, Sep 2, 2015 at 11:44 PM, Shayan Haque <me...@shyyawn.com> wrote:
>> Let me give an example: for suppose we have "public pages" which list cars
>> for makes (they use  q=make:Chery  or   q=make:Toyota etc...) and list cars
>> for all members.
>>
>> Now suppose, in our member account area, there is already a page that lists
>> cars that the current logged in member had posted. In this listing, we'd
>> like to add, that where on the public pages his published cars shows. So if
>> a member posted a Toyota Car or Honda Car, it should show your posted
>> Toyota Car 1 is shown on 208th 'position' on public page  /toyota/. The
>> public page shows 10 cars per page so that would make it the 21st page but
>> page number is easy to calculate if the position is know.
>>
>> Hope this clears it a bit.
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>> On Thu, Sep 3, 2015 at 1:39 PM Erick Erickson <er...@gmail.com>
>> wrote:
>>
>>> It's entirely unclear what you mean by "position".
>>>
>>> bq:  where for "make and model" his
>>> first result comes
>>>
>>> Comes in what? The search result list? Some
>>> a-priori ordering of all the cars that has
>>> nothing to do with this search? The results
>>> list of everyone's cars that have the same
>>> make and model? If this latter, what good
>>> is this doing the user? On what criteria
>>> are the make/model combination ordered so
>>> that the position of the user's car has
>>> meaning?
>>>
>>>  Some concrete examples would help I think.
>>>
>>> Best,
>>> Erick
>>>
>>>
>>> On Wed, Sep 2, 2015 at 9:42 PM, Shayan Haque <me...@shyyawn.com> wrote:
>>> > Thanks for the reply Erick.
>>> >
>>> > How do I get the position? I am searching on e.g. car model and make,
>>> and I
>>> > want to show on which position the members's first car falls for that
>>> > specific car model and make. So I tell solr, get listing for the cars
>>> with
>>> > the model and make. I want from that result, if the member's first result
>>> > is 208th document, could be 2008th.
>>> >
>>> > Well the web interface that I need to implement is different though. In
>>> > actual the member will see all his cars with where for "make and model"
>>> his
>>> > first result comes. If I get the above thing to work, I'd basically
>>> search
>>> > solr for each of his car's make and model. It will be 12 or 24 cars per
>>> > page, so it's not the best solution but still better if solr can give the
>>> > position. Alternate would be to I have to loop all the results pr solr
>>> > search, that would be even worse, 12 * 10000+ results. I may even have
>>> > limit the search to 1000 positions per make and model or some other cap
>>> and
>>> > show user not the exact position if not found in the 1000 result.
>>> >
>>> >
>>> > Maybe I am not thinking in the right direction using Solr for this. Can't
>>> > think how I'd get the position any other way as the site's public pages
>>> use
>>> > solr for listing.
>>> >
>>> >
>>> >
>>> > -
>>> > Regards,
>>> > Shayan
>>> >
>>> >
>>> >
>>> >
>>> >
>>> >
>>> >
>>> >
>>> >
>>> >
>>> > On Thu, Sep 3, 2015 at 12:08 PM Erick Erickson <er...@gmail.com>
>>> > wrote:
>>> >
>>> >> Well, you have access to the start parameter, isn't it just
>>> >> start+(ordinal position in the page)?
>>> >>
>>> >> Best,
>>> >> Erick
>>> >>
>>> >> On Wed, Sep 2, 2015 at 7:01 PM, Shayan Haque <me...@shyyawn.com> wrote:
>>> >> > Hi,
>>> >> >
>>> >> > I need to get a document position within a search result for a
>>> specific
>>> >> > member, to show them where there result lie for a particular set of
>>> >> > filters... I tried using a Solr-Ranking plugin but its outdated,
>>> version
>>> >> > 3.5 compatible. Is there some other way?
>>> >> > Ordinal ranking or any other thing.. the version I am using is solr
>>> 4.7.
>>> >> > The last resort would be counting in the app.. but the issue is that
>>> >> would
>>> >> > be extensive... it would mean running a Solr request for each listed
>>> item
>>> >> > to get its position by looping through the results till X page or X
>>> limit
>>> >> > ... can't traverse all data.
>>> >> >
>>> >> > Help plz.
>>> >> >
>>> >> >
>>> >> > -Shayan
>>> >>
>>>
>> --
>>
>> Kind Regards,
>> Shayan

Re: Position of Document in Listing (Search Result)

Posted by Erick Erickson <er...@gmail.com>.
OK, but how are they ordered on the public pages? I'm guessing
that what I'm missing here is something like
"If I did an identical search on the public pages, my car would be
number 208" _Something_ has to glue the two separate pages
together.

If it's something like that I don't see a good way to handle it. The
position of the member's car on the public page sounds like
it changes by query, i.e. if the search is "blue chevy" cars then
the position would be different than just "chevy".

Even if it were a static ranking, by the time you tried to make static
lists for all the combinations it'd be a nightmare if it was do-able at
all.

Don't see a clean way to do this off the top of my head.

Best,
Erick

On Wed, Sep 2, 2015 at 11:44 PM, Shayan Haque <me...@shyyawn.com> wrote:
> Let me give an example: for suppose we have "public pages" which list cars
> for makes (they use  q=make:Chery  or   q=make:Toyota etc...) and list cars
> for all members.
>
> Now suppose, in our member account area, there is already a page that lists
> cars that the current logged in member had posted. In this listing, we'd
> like to add, that where on the public pages his published cars shows. So if
> a member posted a Toyota Car or Honda Car, it should show your posted
> Toyota Car 1 is shown on 208th 'position' on public page  /toyota/. The
> public page shows 10 cars per page so that would make it the 21st page but
> page number is easy to calculate if the position is know.
>
> Hope this clears it a bit.
>
>
>
>
>
>
>
>
>
>
> On Thu, Sep 3, 2015 at 1:39 PM Erick Erickson <er...@gmail.com>
> wrote:
>
>> It's entirely unclear what you mean by "position".
>>
>> bq:  where for "make and model" his
>> first result comes
>>
>> Comes in what? The search result list? Some
>> a-priori ordering of all the cars that has
>> nothing to do with this search? The results
>> list of everyone's cars that have the same
>> make and model? If this latter, what good
>> is this doing the user? On what criteria
>> are the make/model combination ordered so
>> that the position of the user's car has
>> meaning?
>>
>>  Some concrete examples would help I think.
>>
>> Best,
>> Erick
>>
>>
>> On Wed, Sep 2, 2015 at 9:42 PM, Shayan Haque <me...@shyyawn.com> wrote:
>> > Thanks for the reply Erick.
>> >
>> > How do I get the position? I am searching on e.g. car model and make,
>> and I
>> > want to show on which position the members's first car falls for that
>> > specific car model and make. So I tell solr, get listing for the cars
>> with
>> > the model and make. I want from that result, if the member's first result
>> > is 208th document, could be 2008th.
>> >
>> > Well the web interface that I need to implement is different though. In
>> > actual the member will see all his cars with where for "make and model"
>> his
>> > first result comes. If I get the above thing to work, I'd basically
>> search
>> > solr for each of his car's make and model. It will be 12 or 24 cars per
>> > page, so it's not the best solution but still better if solr can give the
>> > position. Alternate would be to I have to loop all the results pr solr
>> > search, that would be even worse, 12 * 10000+ results. I may even have
>> > limit the search to 1000 positions per make and model or some other cap
>> and
>> > show user not the exact position if not found in the 1000 result.
>> >
>> >
>> > Maybe I am not thinking in the right direction using Solr for this. Can't
>> > think how I'd get the position any other way as the site's public pages
>> use
>> > solr for listing.
>> >
>> >
>> >
>> > -
>> > Regards,
>> > Shayan
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> > On Thu, Sep 3, 2015 at 12:08 PM Erick Erickson <er...@gmail.com>
>> > wrote:
>> >
>> >> Well, you have access to the start parameter, isn't it just
>> >> start+(ordinal position in the page)?
>> >>
>> >> Best,
>> >> Erick
>> >>
>> >> On Wed, Sep 2, 2015 at 7:01 PM, Shayan Haque <me...@shyyawn.com> wrote:
>> >> > Hi,
>> >> >
>> >> > I need to get a document position within a search result for a
>> specific
>> >> > member, to show them where there result lie for a particular set of
>> >> > filters... I tried using a Solr-Ranking plugin but its outdated,
>> version
>> >> > 3.5 compatible. Is there some other way?
>> >> > Ordinal ranking or any other thing.. the version I am using is solr
>> 4.7.
>> >> > The last resort would be counting in the app.. but the issue is that
>> >> would
>> >> > be extensive... it would mean running a Solr request for each listed
>> item
>> >> > to get its position by looping through the results till X page or X
>> limit
>> >> > ... can't traverse all data.
>> >> >
>> >> > Help plz.
>> >> >
>> >> >
>> >> > -Shayan
>> >>
>>
> --
>
> Kind Regards,
> Shayan

Re: Position of Document in Listing (Search Result)

Posted by Shayan Haque <me...@shyyawn.com>.
Let me give an example: for suppose we have "public pages" which list cars
for makes (they use  q=make:Chery  or   q=make:Toyota etc...) and list cars
for all members.

Now suppose, in our member account area, there is already a page that lists
cars that the current logged in member had posted. In this listing, we'd
like to add, that where on the public pages his published cars shows. So if
a member posted a Toyota Car or Honda Car, it should show your posted
Toyota Car 1 is shown on 208th 'position' on public page  /toyota/. The
public page shows 10 cars per page so that would make it the 21st page but
page number is easy to calculate if the position is know.

Hope this clears it a bit.










On Thu, Sep 3, 2015 at 1:39 PM Erick Erickson <er...@gmail.com>
wrote:

> It's entirely unclear what you mean by "position".
>
> bq:  where for "make and model" his
> first result comes
>
> Comes in what? The search result list? Some
> a-priori ordering of all the cars that has
> nothing to do with this search? The results
> list of everyone's cars that have the same
> make and model? If this latter, what good
> is this doing the user? On what criteria
> are the make/model combination ordered so
> that the position of the user's car has
> meaning?
>
>  Some concrete examples would help I think.
>
> Best,
> Erick
>
>
> On Wed, Sep 2, 2015 at 9:42 PM, Shayan Haque <me...@shyyawn.com> wrote:
> > Thanks for the reply Erick.
> >
> > How do I get the position? I am searching on e.g. car model and make,
> and I
> > want to show on which position the members's first car falls for that
> > specific car model and make. So I tell solr, get listing for the cars
> with
> > the model and make. I want from that result, if the member's first result
> > is 208th document, could be 2008th.
> >
> > Well the web interface that I need to implement is different though. In
> > actual the member will see all his cars with where for "make and model"
> his
> > first result comes. If I get the above thing to work, I'd basically
> search
> > solr for each of his car's make and model. It will be 12 or 24 cars per
> > page, so it's not the best solution but still better if solr can give the
> > position. Alternate would be to I have to loop all the results pr solr
> > search, that would be even worse, 12 * 10000+ results. I may even have
> > limit the search to 1000 positions per make and model or some other cap
> and
> > show user not the exact position if not found in the 1000 result.
> >
> >
> > Maybe I am not thinking in the right direction using Solr for this. Can't
> > think how I'd get the position any other way as the site's public pages
> use
> > solr for listing.
> >
> >
> >
> > -
> > Regards,
> > Shayan
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> > On Thu, Sep 3, 2015 at 12:08 PM Erick Erickson <er...@gmail.com>
> > wrote:
> >
> >> Well, you have access to the start parameter, isn't it just
> >> start+(ordinal position in the page)?
> >>
> >> Best,
> >> Erick
> >>
> >> On Wed, Sep 2, 2015 at 7:01 PM, Shayan Haque <me...@shyyawn.com> wrote:
> >> > Hi,
> >> >
> >> > I need to get a document position within a search result for a
> specific
> >> > member, to show them where there result lie for a particular set of
> >> > filters... I tried using a Solr-Ranking plugin but its outdated,
> version
> >> > 3.5 compatible. Is there some other way?
> >> > Ordinal ranking or any other thing.. the version I am using is solr
> 4.7.
> >> > The last resort would be counting in the app.. but the issue is that
> >> would
> >> > be extensive... it would mean running a Solr request for each listed
> item
> >> > to get its position by looping through the results till X page or X
> limit
> >> > ... can't traverse all data.
> >> >
> >> > Help plz.
> >> >
> >> >
> >> > -Shayan
> >>
>
-- 

Kind Regards,
Shayan

Re: Position of Document in Listing (Search Result)

Posted by Erick Erickson <er...@gmail.com>.
It's entirely unclear what you mean by "position".

bq:  where for "make and model" his
first result comes

Comes in what? The search result list? Some
a-priori ordering of all the cars that has
nothing to do with this search? The results
list of everyone's cars that have the same
make and model? If this latter, what good
is this doing the user? On what criteria
are the make/model combination ordered so
that the position of the user's car has
meaning?

 Some concrete examples would help I think.

Best,
Erick


On Wed, Sep 2, 2015 at 9:42 PM, Shayan Haque <me...@shyyawn.com> wrote:
> Thanks for the reply Erick.
>
> How do I get the position? I am searching on e.g. car model and make, and I
> want to show on which position the members's first car falls for that
> specific car model and make. So I tell solr, get listing for the cars with
> the model and make. I want from that result, if the member's first result
> is 208th document, could be 2008th.
>
> Well the web interface that I need to implement is different though. In
> actual the member will see all his cars with where for "make and model" his
> first result comes. If I get the above thing to work, I'd basically search
> solr for each of his car's make and model. It will be 12 or 24 cars per
> page, so it's not the best solution but still better if solr can give the
> position. Alternate would be to I have to loop all the results pr solr
> search, that would be even worse, 12 * 10000+ results. I may even have
> limit the search to 1000 positions per make and model or some other cap and
> show user not the exact position if not found in the 1000 result.
>
>
> Maybe I am not thinking in the right direction using Solr for this. Can't
> think how I'd get the position any other way as the site's public pages use
> solr for listing.
>
>
>
> -
> Regards,
> Shayan
>
>
>
>
>
>
>
>
>
>
> On Thu, Sep 3, 2015 at 12:08 PM Erick Erickson <er...@gmail.com>
> wrote:
>
>> Well, you have access to the start parameter, isn't it just
>> start+(ordinal position in the page)?
>>
>> Best,
>> Erick
>>
>> On Wed, Sep 2, 2015 at 7:01 PM, Shayan Haque <me...@shyyawn.com> wrote:
>> > Hi,
>> >
>> > I need to get a document position within a search result for a specific
>> > member, to show them where there result lie for a particular set of
>> > filters... I tried using a Solr-Ranking plugin but its outdated, version
>> > 3.5 compatible. Is there some other way?
>> > Ordinal ranking or any other thing.. the version I am using is solr 4.7.
>> > The last resort would be counting in the app.. but the issue is that
>> would
>> > be extensive... it would mean running a Solr request for each listed item
>> > to get its position by looping through the results till X page or X limit
>> > ... can't traverse all data.
>> >
>> > Help plz.
>> >
>> >
>> > -Shayan
>>

Re: Position of Document in Listing (Search Result)

Posted by Shayan Haque <me...@shyyawn.com>.
Thanks for the reply Erick.

How do I get the position? I am searching on e.g. car model and make, and I
want to show on which position the members's first car falls for that
specific car model and make. So I tell solr, get listing for the cars with
the model and make. I want from that result, if the member's first result
is 208th document, could be 2008th.

Well the web interface that I need to implement is different though. In
actual the member will see all his cars with where for "make and model" his
first result comes. If I get the above thing to work, I'd basically search
solr for each of his car's make and model. It will be 12 or 24 cars per
page, so it's not the best solution but still better if solr can give the
position. Alternate would be to I have to loop all the results pr solr
search, that would be even worse, 12 * 10000+ results. I may even have
limit the search to 1000 positions per make and model or some other cap and
show user not the exact position if not found in the 1000 result.


Maybe I am not thinking in the right direction using Solr for this. Can't
think how I'd get the position any other way as the site's public pages use
solr for listing.



-
Regards,
Shayan










On Thu, Sep 3, 2015 at 12:08 PM Erick Erickson <er...@gmail.com>
wrote:

> Well, you have access to the start parameter, isn't it just
> start+(ordinal position in the page)?
>
> Best,
> Erick
>
> On Wed, Sep 2, 2015 at 7:01 PM, Shayan Haque <me...@shyyawn.com> wrote:
> > Hi,
> >
> > I need to get a document position within a search result for a specific
> > member, to show them where there result lie for a particular set of
> > filters... I tried using a Solr-Ranking plugin but its outdated, version
> > 3.5 compatible. Is there some other way?
> > Ordinal ranking or any other thing.. the version I am using is solr 4.7.
> > The last resort would be counting in the app.. but the issue is that
> would
> > be extensive... it would mean running a Solr request for each listed item
> > to get its position by looping through the results till X page or X limit
> > ... can't traverse all data.
> >
> > Help plz.
> >
> >
> > -Shayan
>

Re: Position of Document in Listing (Search Result)

Posted by Erick Erickson <er...@gmail.com>.
Well, you have access to the start parameter, isn't it just
start+(ordinal position in the page)?

Best,
Erick

On Wed, Sep 2, 2015 at 7:01 PM, Shayan Haque <me...@shyyawn.com> wrote:
> Hi,
>
> I need to get a document position within a search result for a specific
> member, to show them where there result lie for a particular set of
> filters... I tried using a Solr-Ranking plugin but its outdated, version
> 3.5 compatible. Is there some other way?
> Ordinal ranking or any other thing.. the version I am using is solr 4.7.
> The last resort would be counting in the app.. but the issue is that would
> be extensive... it would mean running a Solr request for each listed item
> to get its position by looping through the results till X page or X limit
> ... can't traverse all data.
>
> Help plz.
>
>
> -Shayan