Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Lucene: Java-User

recovering terms hit from wildcard queries

 

 

Lucene java-user RSS feed   Index | Next | Previous | View Threaded


ctignor at thinkmap

Nov 18, 2009, 1:39 PM

Post #1 of 4 (521 views)
Permalink
recovering terms hit from wildcard queries

Hello,

Firstly, thanks for all the good answers and support form this mailing list.

Would it be possible and if so, what would be the best way to recover the
terms filled in for a wildcard query following a successful search?

For example:
If I parse and execute a query using the string "my*" and get a collection
of document ids that match this search,
is there a good way to determine whether this query found "myopic", "mylar"
or some other term without loading/searching the returned documents?

thanks!

C>T>

--
TH!NKMAP

Christopher Tignor | Senior Software Architect
155 Spring Street NY, NY 10012
p.212-285-8600 x385 f.212-285-8999


simon.willnauer at googlemail

Nov 18, 2009, 2:16 PM

Post #2 of 4 (493 views)
Permalink
Re: recovering terms hit from wildcard queries [In reply to]

You could use WildcardTermEnum directly and pass your term and the
reader to it. This will allow you to enumerate all terms that match
your wildcard term.
Is that what are you asking for?

simon

On Wed, Nov 18, 2009 at 10:39 PM, Christopher Tignor
<ctignor [at] thinkmap> wrote:
> Hello,
>
> Firstly, thanks for all the good answers and support form this mailing list.
>
> Would it be possible and if so, what would be the best way to recover the
> terms filled in for a wildcard query following a successful search?
>
> For example:
> If I parse and execute a query using the string "my*" and get a collection
> of document ids that match this search,
> is there a good way to determine whether this query found "myopic", "mylar"
> or some other term without loading/searching the returned documents?
>
> thanks!
>
> C>T>
>
> --
> TH!NKMAP
>
> Christopher Tignor | Senior Software Architect
> 155 Spring Street NY, NY 10012
> p.212-285-8600 x385 f.212-285-8999
>

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe [at] lucene
For additional commands, e-mail: java-user-help [at] lucene


ctignor at thinkmap

Nov 18, 2009, 2:30 PM

Post #3 of 4 (478 views)
Permalink
Re: recovering terms hit from wildcard queries [In reply to]

Thanks - that might work though I believe would produce many queries instead
of just one to maintain the specific Term used to match a given hit
document.

I presume then I would get all the actual terms from the WildcardTermEnum
that my wildcard containing string refers to and then use them each in
separate query so I could know precisely which Term is associated with a
given document.

thanks,


On Wed, Nov 18, 2009 at 5:16 PM, Simon Willnauer <
simon.willnauer [at] googlemail> wrote:

> You could use WildcardTermEnum directly and pass your term and the
> reader to it. This will allow you to enumerate all terms that match
> your wildcard term.
> Is that what are you asking for?
>
> simon
>
> On Wed, Nov 18, 2009 at 10:39 PM, Christopher Tignor
> <ctignor [at] thinkmap> wrote:
> > Hello,
> >
> > Firstly, thanks for all the good answers and support form this mailing
> list.
> >
> > Would it be possible and if so, what would be the best way to recover the
> > terms filled in for a wildcard query following a successful search?
> >
> > For example:
> > If I parse and execute a query using the string "my*" and get a
> collection
> > of document ids that match this search,
> > is there a good way to determine whether this query found "myopic",
> "mylar"
> > or some other term without loading/searching the returned documents?
> >
> > thanks!
> >
> > C>T>
> >
> > --
> > TH!NKMAP
> >
> > Christopher Tignor | Senior Software Architect
> > 155 Spring Street NY, NY 10012
> > p.212-285-8600 x385 f.212-285-8999
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe [at] lucene
> For additional commands, e-mail: java-user-help [at] lucene
>
>


--
TH!NKMAP

Christopher Tignor | Senior Software Architect
155 Spring Street NY, NY 10012
p.212-285-8600 x385 f.212-285-8999


uwe at thetaphi

Nov 18, 2009, 3:02 PM

Post #4 of 4 (478 views)
Permalink
RE: recovering terms hit from wildcard queries [In reply to]

> Thanks - that might work though I believe would produce many queries
> instead
> of just one to maintain the specific Term used to match a given hit
> document.
>
> I presume then I would get all the actual terms from the WildcardTermEnum
> that my wildcard containing string refers to and then use them each in
> separate query so I could know precisely which Term is associated with a
> given document.

The solution for this is IndexReader's TermDocs. Just retrieve the next term
(while loop) and them seek the TermDocs to the returned Term and iterate all
document Ids. That's how the query internally works.

The code that does this can be found in MultiTermQueryWrapperFilter (it
iterates over such a FilteredTermEnum and retrieves all document ids for
each term), that marks them in a OpenBitSet.

Just rewrite the loop and you get what you want.

> On Wed, Nov 18, 2009 at 5:16 PM, Simon Willnauer <
> simon.willnauer [at] googlemail> wrote:
>
> > You could use WildcardTermEnum directly and pass your term and the
> > reader to it. This will allow you to enumerate all terms that match
> > your wildcard term.
> > Is that what are you asking for?
> >
> > simon
> >
> > On Wed, Nov 18, 2009 at 10:39 PM, Christopher Tignor
> > <ctignor [at] thinkmap> wrote:
> > > Hello,
> > >
> > > Firstly, thanks for all the good answers and support form this mailing
> > list.
> > >
> > > Would it be possible and if so, what would be the best way to recover
> the
> > > terms filled in for a wildcard query following a successful search?
> > >
> > > For example:
> > > If I parse and execute a query using the string "my*" and get a
> > collection
> > > of document ids that match this search,
> > > is there a good way to determine whether this query found "myopic",
> > "mylar"
> > > or some other term without loading/searching the returned documents?
> > >
> > > thanks!
> > >
> > > C>T>
> > >
> > > --
> > > TH!NKMAP
> > >
> > > Christopher Tignor | Senior Software Architect
> > > 155 Spring Street NY, NY 10012
> > > p.212-285-8600 x385 f.212-285-8999
> > >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: java-user-unsubscribe [at] lucene
> > For additional commands, e-mail: java-user-help [at] lucene
> >
> >
>
>
> --
> TH!NKMAP
>
> Christopher Tignor | Senior Software Architect
> 155 Spring Street NY, NY 10012
> p.212-285-8600 x385 f.212-285-8999


---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe [at] lucene
For additional commands, e-mail: java-user-help [at] lucene

Lucene java-user RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.