RE: question about highlight field
Chris, Thanks for your reply, I got what you said. In my case, I have the following requirements: 1. search on different fields 2. highlight the query string in searching fields, not default search field 3. Use wildcard I think the only option I have is to use standard request handler and specify which field I want to search and add the same field to hl.fl, something similar to ?q=TITLE:consult*&hl=on&hl.fl=TITLE, right? Thanks Xuesong -Original Message- From: Chris Hostetter [mailto:[EMAIL PROTECTED] Sent: Monday, June 04, 2007 11:08 PM To: solr-user@lucene.apache.org Subject: RE: question about highlight field : Thanks for the reply. I'm curious why we want to search one field but : highlight different fields? Doesn't it make more sense to only highlight consider a typical use case: you have an index of articles with fields for the title, description, and body of the article. you search all of them, but on the search results page you only highlight matches in the title and description (maybe you have a "cached" view of each article where you display the stored contents of the article body with highlighting) : the query fields? In my example, if I search f1, f2, f3, most likely I : course I can use hl.fl, but I think it make more sense for solr to : automatically highlight those fields(rather than the default search : field) for us. that wasn't actually your example .. you weren't searching across fields f1, f2 and f3; you were searching for words in the default field ("searchall") that happened to be made by combining the text from f1, f2, and f3 using copyField. As Mike pointed out, if you use dismax to *really* search for your input in f1, f2, and f3 (using the qf param) then Solr will highlight those fields for you. you may be wondering about what happens when you do a search like... http://localhost:8983/solr/select?q=features%3Asolr&hl=on ...ie: your query string explicitly looks for solr in the field features. Solr doesn't "guess" that you want to highlight the features field in this case, it could -- but it would be a bad idea. The hl.fl default "guessing" logic is independent of the fields that appear in the query string ... if you were relying on SOlr to highlight your default search field for you so you could display it in your application, you wouldn't be very happy if your application broke because someone happend to do a field specific query. -Hoss
RE: question about highlight field
: 1. search on different fields : 2. highlight the query string in searching fields, not default search : I think the only option I have is to use standard request handler and : specify which field I want to search and add the same field to hl.fl, : something similar to ?q=TITLE:consult*&hl=on&hl.fl=TITLE, right? pretty much, if you want to ensure that your highlighting only aplies to things that actauly result in query matches, set hl.requireFieldMatch=true that way in queries like this... ?q=DEK:albino+TITLE:elephant&hl=on&hl.fl=TITLE,DEK ...the word elephant won't be highlighted in the DEK field, and the word albino won't be highlighted in the TITLE field. -Hoss
tomcat context fragment
Hello All, I've been working with solr on Tomcat 5.5/Windows and had success setting my solr home using the context fragment. However, I cannot get it to work on Tomcat 5.028/Unix. I've read and re-read the Apache Tomcat documentation and cannot find a solution. Has anyone run into this issue? Is there some Tomcat setting that is preventing this from working? Thanks, Mike
RE: question about highlight field
Good point, I haven't thought about it. It makes sense to use requireFieldMatch in my case. One more question about using wildcard. I found if wildcard is used in the query, the highlight elements only shows unique id, it won't display the field information(See below, the arr section in blue is returned). Is this the designed behavior? ?q=TITLE:consult*&hl=on&hl.fl=TITLE Consultant Thanks Xuesong -Original Message- From: Chris Hostetter [mailto:[EMAIL PROTECTED] Sent: Tuesday, June 05, 2007 12:02 PM To: solr-user@lucene.apache.org Subject: RE: question about highlight field : 1. search on different fields : 2. highlight the query string in searching fields, not default search : I think the only option I have is to use standard request handler and : specify which field I want to search and add the same field to hl.fl, : something similar to ?q=TITLE:consult*&hl=on&hl.fl=TITLE, right? pretty much, if you want to ensure that your highlighting only aplies to things that actauly result in query matches, set hl.requireFieldMatch=true that way in queries like this... ?q=DEK:albino+TITLE:elephant&hl=on&hl.fl=TITLE,DEK ...the word elephant won't be highlighted in the DEK field, and the word albino won't be highlighted in the TITLE field. -Hoss
Multiple doc types in schema
As far as I understand, I can put multiple doc types in the same index, for example, web pages, images, products, etc. In order to do so, I think I need to do the following: - have a doctype field (not necessary but nice to have) - add all possible fields of all doc types in schema - when querying for a particular doc type, make sure to either specify the doctype field, or use fields that are only available in that doc type. This is based on my understanding that solr/lucene does not have the concept of document type. It only sees fields. Is my understanding correct? It seems a bit unclean to mix fields of all document types in the same schema though. Or, is there a way to allow multiple document types in the schema, and specify what type to use when indexing and searching? -- Best regards, Jack
Re: Multiple doc types in schema
: This is based on my understanding that solr/lucene does not : have the concept of document type. It only sees fields. : : Is my understanding correct? it is. : It seems a bit unclean to mix fields of all document types : in the same schema though. Or, is there a way to allow multiple : document types in the schema, and specify what type to use : when indexing and searching? it's really just an issue of semantics ... the schema.xml is where you list all of the fields you need in your index, any notion of doctype is entire artificial ... you could group all of the fields relating to doctypeA in one section of the schema.xml, then have a big line and then list the fields in doctypeB, etc... but wat if there are fields you use in both "doctypes" ? .. how much you "mix" them is entirely up to you. -Hoss
RE: question about highlight field
: One more question about using wildcard. I found if wildcard is used in : the query, the highlight elements only shows unique id, it won't display : : : : Consultant your description of the problem doesn't seem to match what you've pasted ... it looks like it's highlighting just the prefix from the query. You're using Solr 1.1 right? Unfortunately, i think you are damned if you do, damned if you don't ... in Solr 1.1, highlighting used the info from the raw query to do highlighting, hence in your query for consult* it would highlight the Consult part of Consultant even though the prefix query was matchign the whole word. In the trunk (soon to be Solr 1.2) Mike fixed that so the query is "rewritten" to it's expanded form before highlighting is done ... this works great for true wild card queries (ie: cons*t* or cons?lt*) but for prefix queries Solr has an optimization ofr Prefix queries (ie: consult*) to reduce the likely hood of Solr crashing if the prefix matches a lot of terms ... unfortunately this breaks highlighting of prefix queries, and no one has implemented a solution yet... https://issues.apache.org/jira/browse/SOLR-195 -Hoss
RE: question about highlight field
Yes, I'm using 1.1. The example in my last email is an expected result, not the real result. Indeed I didn't see the arr element in the highlighting element when either prefix wildcard or true wildcard query is used. I just tried nightly build, as you said, it works great except for prefix wildcard. Thanks for your help! Xuesong -Original Message- From: Chris Hostetter [mailto:[EMAIL PROTECTED] Sent: Tuesday, June 05, 2007 10:16 PM To: solr-user@lucene.apache.org Subject: RE: question about highlight field : One more question about using wildcard. I found if wildcard is used in : the query, the highlight elements only shows unique id, it won't display : : : : Consultant your description of the problem doesn't seem to match what you've pasted ... it looks like it's highlighting just the prefix from the query. You're using Solr 1.1 right? Unfortunately, i think you are damned if you do, damned if you don't ... in Solr 1.1, highlighting used the info from the raw query to do highlighting, hence in your query for consult* it would highlight the Consult part of Consultant even though the prefix query was matchign the whole word. In the trunk (soon to be Solr 1.2) Mike fixed that so the query is "rewritten" to it's expanded form before highlighting is done ... this works great for true wild card queries (ie: cons*t* or cons?lt*) but for prefix queries Solr has an optimization ofr Prefix queries (ie: consult*) to reduce the likely hood of Solr crashing if the prefix matches a lot of terms ... unfortunately this breaks highlighting of prefix queries, and no one has implemented a solution yet... https://issues.apache.org/jira/browse/SOLR-195 -Hoss