lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Erick Erickson" <erickerick...@gmail.com>
Subject Re: Lucene syntax query matched against a string content
Date Fri, 08 Feb 2008 13:23:03 GMT
You might want to check out MemoryIndex before rejecting putting a single
doc in memory and searching against it. It's quite fast, although whether
it'll
work in your situation only measurement will tell. It's in contrib as I
remember.

Erick

On Feb 7, 2008 11:48 PM, Nilesh Bansal <nileshbansal@gmail.com> wrote:

> Hi,
>
> I want to create a function, which takes in a query string (in lucene
> syntax), and a string as content and returns back if the query matches
> the content or not. This would mean,
>
> query = +(apache) +(lucene OR httpd)
>
> will match
>
> content = HTTPD by Apache foundation is one of the most popular open
> source projects
>
> and will not match
>
> content = Lucene and httpd are projects from same open source foundation
>
> Basically, I need to fill in the contents of the following Java
> function. This should be easy to do, but I don't know how. I obviously
> don't want to create a dummy lucene index in memory with a single
> document and then search for the query against that (for performance
> reasons).
>
> public static boolean isRelevant(String luceneQuery, String contents) {
>  // TODO fill in
> }
>
> Instead of boolean, it could return a relevance score, which will be
> zero if the query is not relevant to the document.
>
> Any help will be appreciated.
>
> thanks
> Nilesh
>
> --
> Nilesh Bansal
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message