Queries with conditional field inclusions?

2013-10-25 Thread Richard Frovarp
I'm trying to put together a query in Solr that is becoming rather 
complicated, and I'm not quite sure where to even start.


I'm building a directory, which for simplicity sake contains:
First Name
Last Name
Department Name (if faculty / staff)
User Types - faculty, staff, student - multivalued.

I want one search field to search first, last, and department. I have 
that working. However, that means you can find students using a first 
name only search, which isn't exactly desirable, but it is desirable for 
faculty and staff.


So I want:

Search Department Name + Last Name every time
include First Name if user type in (faculty, staff) or if another token 
matched last name.


So searching for richard would only work for me if I'm marked as 
faculty or staff. However searching for frovarp richard would limit to 
my record if I was marked as a student as the frovarp piece would match 
against last names.


Any suggestions or ideas? I'm testing against Solr 4.3.1, but will 
probably be updating to 4.5.1 anyway.


I'm open to multiple cores or searches. I actually have 4 different 
first and last name fields (full, ngram, two phonetic), so scoring 
becomes important.


Thanks,
Richard


Re: edismax not working in a core

2012-07-18 Thread Richard Frovarp

On 07/18/2012 11:20 AM, Erick Erickson wrote:

the ~2 is the mm parameter I'm pretty sure. So I'd guess your configuration has
a mm parameter set on the core that isn't doing what you want..



I'm not setting the mm parameter or the q.op parameter. All three cores 
have a defaultOperator of OR. So I don't know where that would be coming 
from. However, if I specify a mm of 0, it appears to work just fine. 
I've added it as a default parameter to the select handler.


Thanks for pointing me in the right direction.

Richard


Re: edismax not working in a core

2012-07-18 Thread Richard Frovarp

On 07/18/2012 02:39 PM, Richard Frovarp wrote:

On 07/18/2012 11:20 AM, Erick Erickson wrote:

the ~2 is the mm parameter I'm pretty sure. So I'd guess your
configuration has
a mm parameter set on the core that isn't doing what you want..



I'm not setting the mm parameter or the q.op parameter. All three cores
have a defaultOperator of OR. So I don't know where that would be coming
from. However, if I specify a mm of 0, it appears to work just fine.
I've added it as a default parameter to the select handler.

Thanks for pointing me in the right direction.

Richard


Okay, that's wrong. Term boosting isn't working either, and what I did 
above just turns everything into an OR query.


I did figure out the problem, however. In the core that wasn't working, 
one of the query field names wasn't correct. No errors were ever thrown, 
it just made the query behave in a very odd way.


I finally figured it out after debugging each field independent of each 
other.


Re: edismax not working in a core

2012-07-17 Thread Richard Frovarp

On 07/14/2012 05:32 PM, Erick Erickson wrote:

Really hard to say. Try executing your query on the cores with
debugQuery=on and compare the parsed results (for this you
can probably just ignore the explain bits of the output, concentrate
on the parsed query).



Okay, for the example core from the project, the query was:

test OR samsung

parsedquery:
+(DisjunctionMaxQuery((id:test^10.0 | text:test^0.5 | cat:test^1.4 | 
manu:test^1.1 | name:test^1.2 | features:test | sku:test^1.5)) 
DisjunctionMaxQuery((id:samsung^10.0 | text:samsung^0.5 | 
cat:samsung^1.4 | manu:samsung^1.1 | name:samsung^1.2 | features:samsung 
| sku:samsung^1.5)))


For my core the query was:

frovarp OR fee

parsedquery:

+((DisjunctionMaxQuery((content:fee | title:fee^5.0 | 
mainContent:fee^2.0)) DisjunctionMaxQuery((content:frovarp | 
title:frovarp^5.0 | mainContent:frovarp^2.0)))~2)


What is that ~2? That's the difference. The third core that works 
properly also doesn't have the ~2.


edismax not working in a core

2012-07-13 Thread Richard Frovarp
I'm having trouble with edismax not working in one of my cores. I have 
three cores up and running, including the demo in Solr 3.6 on Tomcat 
7.0.27 on Java 1.6.


I can't get edismax to work on one of those cores, and it's configured 
very similar to the demo, which does work. I have different fields, but 
overall I'm not doing much different. I'm testing using a query with 
OR in it to try to get a union. On two of the cores, I get the union, 
on my third one I get a much smaller set than either term should return. 
If I tell the misbehaving core to have a defType of lucene, that does 
honor the OR.


What could I be possibly missing?

Thanks,
Richard


Re: Run Solr within my war

2010-02-19 Thread Richard Frovarp

Pulkit Singhal wrote:

Using EmbeddedSolrServer is a client side way of communicating with
Solr via the file system. Solr has to still be up and running before
that. My question is more along the lines of how to put the server
jars that perform the core functionality and bundle them to start up
within a war which is also the application war for the program that
will communicate as the client with the Solr server.
  
I could be way wrong, but my interpretation is that EmbeddedSolrServer 
provides a way to embed Solr into an application without requiring that 
anything else is running.


http://wiki.apache.org/solr/Solrj#EmbeddedSolrServer

If you are looking for a method of your application doing SolrJ calls to 
Solr, without having to install a separate Solr instance, 
EmbeddedSolrServer would meet your needs. You'd have to use a few other 
functions to load the core and register it, but it's doable without 
having anything else running.


Re: Run Solr within my war

2010-02-18 Thread Richard Frovarp

On 2/18/2010 4:22 PM, Pulkit Singhal wrote:

Hello Everyone,

I do NOT want to host Solr separately. I want to run it within my war
with the Java Application which is using it. How easy/difficult is
that to setup? Can anyone with past experience on this topic, please
comment.

thanks,
- Pulkit

   
So basically you're talking about running an embedded version of Solr 
like the EmbeddedSolrServer? I have no experience on this, but this 
should provide you the correct search term to find documentation on use. 
From what little code I've seen to run test cases against Solr, it looks 
relatively straight forward to get running. To use you would use the 
SolrJ library to communicate with the embedded solr server.


Richard


Re: Updating a single field in a Solr document

2010-01-19 Thread Richard Frovarp

Shalin Shekhar Mangar wrote:

On Mon, Jan 18, 2010 at 5:11 PM, Raghuveer Kancherla 
raghuveer.kanche...@aplopio.com wrote:

  

Hi,
I have 2 fields one with captures the category of the documents and an
other
which is a pre processed text of the document. Text of the document is
fairly large.
The category of the document changes often while the text remains the same.
Search happens on both fields.

The problem is, I have to index both the text and the category each time
the
category changes. The text being large obviously makes this suboptimal. Is
there a patch or a tricky way to avoid indexing the text field every time.




Sure, make the text field as stored, read the old document and create the
new one. Sorry, there is no way to update an indexed document in Solr (yet).

  
Could you use SolrJ to grab a record, convert it over to an input record 
and update the one field? I suppose Solr would still reindex the whole 
thing, but at least you wouldn't have to do full pre-processing on the 
source.


Richard