lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ian Lea <ian....@gmail.com>
Subject Re: Find documents contained in search term
Date Fri, 17 Aug 2012 12:55:35 GMT
Can't see how you could do it with standard queries, but you could
reverse the process and use a MemoryIndex.

Add the single target phrase to the memory index then loop round all
docs executing a search for each one.  Maybe use PrefixQuery although
I'd worry about performance.  Try it and see.

But if you're just doing string comparison

for each doc {
  if target.startsWith(doc.text) {
    // match
  }
}

might be easier.


--
Ian.

On Thu, Aug 16, 2012 at 6:38 PM, davidbrai <davidbrai@gmail.com> wrote:
> Hi,
>
> I have a situation in which I have many short documents (30-400 chars).
> My goal is given a phrase, find an indexed document which is a prefix of the
> phrase.
> Is there a way to achieve this goal using lucene using a single query?
>
> Thanks,
> David.
>
>
>
> --
> View this message in context: http://lucene.472066.n3.nabble.com/Find-documents-contained-in-search-term-tp4001663.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


Mime
View raw message