You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@lucene.apache.org by tituspullo <lu...@hotmail.de> on 2010/06/10 17:54:02 UTC

Finding the position of search hits from Lucene

Hello

How can I find  and save  the position of search hits from Lucene ?..
Like this: 
doc1 : 1
doc2: 2
...
doc 100: 100

I use lucene 3.0

Thank U

Titus
-- 
View this message in context: http://lucene.472066.n3.nabble.com/Finding-the-position-of-search-hits-from-Lucene-tp885956p885956.html
Sent from the Lucene - Java Users mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Re: Finding the position of search hits from Lucene

Posted by Ian Lea <ia...@gmail.com>.
Surely that is what you've got if you use the scoreDocs array as Simon
suggests.  Zero based of course.


--
Ian.


On Thu, Jun 10, 2010 at 6:21 PM, tituspullo <lu...@hotmail.de> wrote:
>
> Yes ...I can do it ..like this
> """
> doc=1900 score=0.15945715
> doc=1192 score=0.09865908
> doc=2134 score=0.084564924
> doc=1774 score=0.07047077
> ""
> But i don't want this....
> I would like to have ....
>
> doc=1900 position 1
> doc=1192 position 2
> doc=2134 position 3
> doc=1774 position 4 .
> ......
> doc = 2345 position 200
>
> ...
> --
> View this message in context: http://lucene.472066.n3.nabble.com/Finding-the-position-of-search-hits-from-Lucene-tp885956p886229.html
> Sent from the Lucene - Java Users mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Re: Finding the position of search hits from Lucene

Posted by tituspullo <lu...@hotmail.de>.
Yes ...I can do it ..like this
"""
doc=1900 score=0.15945715
doc=1192 score=0.09865908
doc=2134 score=0.084564924
doc=1774 score=0.07047077
""
But i don't want this....
I would like to have ....

doc=1900 position 1
doc=1192 position 2
doc=2134 position 3
doc=1774 position 4 .
......
doc = 2345 position 200

...
-- 
View this message in context: http://lucene.472066.n3.nabble.com/Finding-the-position-of-search-hits-from-Lucene-tp885956p886229.html
Sent from the Lucene - Java Users mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Re: Finding the position of search hits from Lucene

Posted by Simon Willnauer <si...@googlemail.com>.
Can't you simply use the TopDocs#scoreDocs array to figure out the
ranked position and the doc Id?!

simon

On Thu, Jun 10, 2010 at 7:01 PM, tituspullo <lu...@hotmail.de> wrote:
>
> Hello
>
> I mean for a simple search I want the id and and the position of rank, for
> all the id's..
> simply ..:)
> I try to rerank and  want to  know  later exactly  the original position in
> the hitlist..
>
> titus
> --
> View this message in context: http://lucene.472066.n3.nabble.com/Finding-the-position-of-search-hits-from-Lucene-tp885956p886146.html
> Sent from the Lucene - Java Users mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Re: Finding the position of search hits from Lucene

Posted by tituspullo <lu...@hotmail.de>.
Hello

I mean for a simple search I want the id and and the position of rank, for
all the id's..
simply ..:) 
I try to rerank and  want to  know  later exactly  the original position in
the hitlist..

titus
-- 
View this message in context: http://lucene.472066.n3.nabble.com/Finding-the-position-of-search-hits-from-Lucene-tp885956p886146.html
Sent from the Lucene - Java Users mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Re: Finding the position of search hits from Lucene

Posted by Simon Willnauer <si...@googlemail.com>.
On Thu, Jun 10, 2010 at 5:54 PM, tituspullo <lu...@hotmail.de> wrote:
>
> Hello
>
> How can I find  and save  the position of search hits from Lucene ?..
Do you mean the positions where a particular term occurred in a document?
If so you should look at TermPositions or if you wanna extend some
kind of query have a look at Spans / SpanQuery

Anyway I have to admit I do not understand your example :)

simon
> Like this:
> doc1 : 1
> doc2: 2
> ...
> doc 100: 100
>
> I use lucene 3.0
>
> Thank U
>
> Titus
> --
> View this message in context: http://lucene.472066.n3.nabble.com/Finding-the-position-of-search-hits-from-Lucene-tp885956p885956.html
> Sent from the Lucene - Java Users mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org