lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kristian Rickert <>
Subject "Private" fields in solr
Date Fri, 07 Oct 2011 14:50:27 GMT
Is there a way to include the notion of "private" fields for a text search?

For example, let's say I have three fields:
UserName - text name
UserCity - city the user belongs to
PrivateUserTags - key/value pair of another user's "tags" about that user

I'd like to have a text search on all three fields but when matching
on the private tags, only match on the tags of the particular user.

So I'd like to have a query like this:

Let's say that User ID 100 is searching:

Main Query:(query1 OR query2)

q=great user
qf=userName userCity

q=great user
...And then somehow tie user ID 100 to this.

So far I've thought of the following ways, but I'd like to know if
there's a more elegant approach in solr:
1) prefix the user's ID to each keyword in the privateUserTag field,
changing the query2 query to 100_great 100_user
2) use a dynamic field for privateUserTags - so the field would be

A third way would be to introduce a new field type (PrivateText?) that
would be a poly field array.

So for I'm feeling #2 is the most elegant - is there a better way to
do this?  I'd especially like it if I can add this functionality to a
single dismax query since the boost query that I use is somewhat



View raw message