List Info

Thread: Problem searching




Problem searching
user name
2006-09-29 00:35:39
I have weird results when I create documents with input such
as  
burmilla2.jpg.

Here is some example code:

Document doc = new Document()
doc.add(new Field("combined", "jorourke"
+ " " + "burmilla2.jpg" ,  
Field.Store.YES, Field.Index.TOKENIZED))

indexWriter.addDocument(doc)

QueryParser parser = new QueryParser("combined",
new StandardAnalyzer())
parser.setDefaultOperator(QueryParser.Operator.AND)
Query q = parser.parse("jorourke burmilla2")

indexSearch.search(q,  Sort.RELEVANCE)

this returns no results

where as:

Query q = parser.parse("jorourke burmilla")

does return the document!!

Anyone have any ideas?

James

PS. The code is a rough translation but you get the idea.
For some  
reason I think the index doesn't like "."'s in
words.



------------------------------------------------------------
---------
To unsubscribe, e-mail: java-user-unsubscribelucene.apache.org
For additional commands, e-mail: java-user-helplucene.apache.org

Problem searching
user name
2006-09-29 00:57:10
Sure, what analyzer are you using? Both for indexing and
parsing the query?
I'll bet that you're using a tokenizer (in one or both) that
breaks your
input stream up in ways you're not expecting.

Get a copy of luke (google lucene luke) if you haven't
already and look at
what's in your index. You can also use several different
analyzers for a
query and see what is produced. You'll be glad you
did<G>.

You can also look at the query. I don't remember whether
toString prints the
query or there's another call, but you can probably find it
without too much
trouble.

Hope this helps
Erick

On 9/28/06, James O'Rourke <jamesbittorrent.com> wrote:
>
> I have weird results when I create documents with input
such as
> burmilla2.jpg.
>
> Here is some example code:
>
> Document doc = new Document()
> doc.add(new Field("combined",
"jorourke" + " " +
"burmilla2.jpg" ,
> Field.Store.YES, Field.Index.TOKENIZED))
>
> indexWriter.addDocument(doc)
>
> QueryParser parser = new
QueryParser("combined", new StandardAnalyzer())
> parser.setDefaultOperator(QueryParser.Operator.AND)
> Query q = parser.parse("jorourke burmilla2")
>
> indexSearch.search(q,  Sort.RELEVANCE)
>
> this returns no results
>
> where as:
>
> Query q = parser.parse("jorourke burmilla")
>
> does return the document!!
>
> Anyone have any ideas?
>
> James
>
> PS. The code is a rough translation but you get the
idea. For some
> reason I think the index doesn't like "."'s
in words.
>
>
>
>
------------------------------------------------------------
---------
> To unsubscribe, e-mail: java-user-unsubscribelucene.apache.org
> For additional commands, e-mail: java-user-helplucene.apache.org
>
>
Problem searching
user name
2006-09-29 01:36:43
Wow, thanks, just found a significant bug - thought I was
using  
StandardAnalyzer throughout but was not!! ouch! Nasty typo.

Thanks again.

James



On Sep 28, 2006, at 5:57 PM, Erick Erickson wrote:

> Sure, what analyzer are you using? Both for indexing
and parsing  
> the query?
> I'll bet that you're using a tokenizer (in one or both)
that breaks  
> your
> input stream up in ways you're not expecting.
>
> Get a copy of luke (google lucene luke) if you haven't
already and  
> look at
> what's in your index. You can also use several
different analyzers  
> for a
> query and see what is produced. You'll be glad you
did<G>.
>
> You can also look at the query. I don't remember
whether toString  
> prints the
> query or there's another call, but you can probably
find it without  
> too much
> trouble.
>
> Hope this helps
> Erick
>
> On 9/28/06, James O'Rourke <jamesbittorrent.com> wrote:
>>
>> I have weird results when I create documents with
input such as
>> burmilla2.jpg.
>>
>> Here is some example code:
>>
>> Document doc = new Document()
>> doc.add(new Field("combined",
"jorourke" + " " +
"burmilla2.jpg" ,
>> Field.Store.YES, Field.Index.TOKENIZED))
>>
>> indexWriter.addDocument(doc)
>>
>> QueryParser parser = new
QueryParser("combined", new  
>> StandardAnalyzer())
>> parser.setDefaultOperator(QueryParser.Operator.AND)
>> Query q = parser.parse("jorourke
burmilla2")
>>
>> indexSearch.search(q,  Sort.RELEVANCE)
>>
>> this returns no results
>>
>> where as:
>>
>> Query q = parser.parse("jorourke
burmilla")
>>
>> does return the document!!
>>
>> Anyone have any ideas?
>>
>> James
>>
>> PS. The code is a rough translation but you get the
idea. For some
>> reason I think the index doesn't like
"."'s in words.
>>
>>
>>
>>
------------------------------------------------------------
---------
>> To unsubscribe, e-mail: java-user-unsubscribelucene.apache.org
>> For additional commands, e-mail: java-user-helplucene.apache.org
>>
>>


------------------------------------------------------------
---------
To unsubscribe, e-mail: java-user-unsubscribelucene.apache.org
For additional commands, e-mail: java-user-helplucene.apache.org

[1-3]

about | contact  Other archives ( Real Estate discussion Medical topics )