lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From <erlend.bjo...@aftenposten.no>
Subject SV: SV: Search in multi fields with cross field AND ?
Date Fri, 05 Aug 2005 12:21:05 GMT
Hi Martin!

It's starts to work know, thanks !! :-)

>In my case "text" is everything. Whenever I add anything to the index, I 
>also add a "text" Field. So in your case, I would build the index like 
>you did with an additional

>doc.add(Field.Text("text", bean.getCompanyName()));

I see, but I don't quite like this way to do it, would have been much better 
to  work with the different fields and use something like MultiFieldQueryParser
that supported a query over multi fields, cross field AND.

But there the only way to fix this is one field like your "text" ??? 

---

Now if you want to keep track, print out the fields too, you need to add 
the other fields as metadata in different fields.

Anyway it work pretty well now, search and scoring, doing muliti field and 
cross AND search, but two things that I'm not sure about. I'm doing like this now:


            if(bean.getCompanyName() != null) {
                doc.add(Field.Text("companyName", bean.getCompanyName()));
                doc.add(Field.Text("text", bean.getCompanyName()));
            }

            if(bean.getKeywords1() != null) {
                doc.add(Field.Text("keywords1", bean.getKeywords1()));
                Field f = Field.Text("text", bean.getKeywords1());
                f.setBoost(3.0f);   // Works fine too :-)
                doc.add(f);
            }
		......

When I print out "text", after search, I only see the companyName in 
the text field even if I have put keywords1, 2 +++ text too into it.
Should it be like that ? ... The search works just fine for all words added.

Strange ??

---

Else the sorting is strange too, it almost work, if I sort like this:

        Sort sort = new Sort(new SortField[] {new SortField("companyName", false)});
        Hits h = is.search(query, sort);

I get the hits list like this:

Aeroauto AS 
Alfa Bilutleie 
Asker Bilutleie AS 
Billig Bilutleie 
Bislet Bilutleie AS 
Budget Bilutleie 
Bærum Bilutleie AS       ('æ' is after u in the norwegian alpha.)
Carent Bilutleie 
Hertz Bilutleie 
National Bilutleie 
Budget Bilutleie Oslo Lufthavn 
Oslo Bilutleie AS 
Reisefeber 
Saga Bilutleie 
Scandinavia Bilutleie A/S 
Budget Bilutleie Oslo Sentrum 
Utleiekontor Oslo 
Østre Aker Bilutleie AS 

Both "Budget Bilutleie Oslo Lufthavn" and "Budget Bilutleie Oslo Sentrum" 
are sorted wrong, very strange... Something to do with how I do it ? Hmmm
Even the special norwegian letter 'Ø' is correct sorted (last).

Any clues ?

>Anyway you should definitely get "luke". Browse the index you created!

Got Luke... Great to look into, will it help me with the sort problem ? Hmm


Take care,
Erlend

---------------------------------------------------------------------
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