The problem stems from using the query parser for searching a non tokenized
field ("book").

You can either create a term query for searching in that field, like this:
   new TermQuery(new Term("book","first title"));
Or tokenize the field "book" and keep using QueryParser.

Decision is based on how you want to search the book field. If you always
search for the entire field - TermQuery is the way. For searching within
the text of this field, i.e. when knowing only part of the book title,
tokenizing this field would be the right way.

Bill Taylor <[EMAIL PROTECTED]> wrote on 02/10/2006 20:14:16:

> I am indexing individual pages of books.
>
> I get no results from the query
>
> accurate AND book:"first title"
>
> Each lucene document which represents one page of one book gets a field
> "book" which is indexed, stored, and not tokenized to store the title
> of the book.
>
> The word "accurate" appears on page one of the book "first title" as
> well as in some other books.  I can find "accurate" alone, in which
> case, it shows up from the other books as well.  But if I try to
> restrict the search to the book named "first title," I get no hits.
>
> Am I using the wrong query syntax?  I am using lucene 2.0 and the
> documentation says the query syntax is for 1.9.
>
> When I stepped through the query, the query parser created two things
> to search for, but did not find anything.
>
> It also did not find anything when I looked for
>
> book:"first title"
>
> or
>
> book:(+"first title")
>
> Luke says that there are 50 occurrences of "first title" in the book:
> field, which is the same number as there are pages in the document, so
> I suspect I am creating the index properly but not searching it
> properly.
>
> I got the expected number of responses to
>
> page:1
>
> but when I asked for page:[1 3]
>
> it appeared to find far too many pages.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to