You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by deniz <de...@gmail.com> on 2011/10/10 03:34:26 UTC

searching documents partially

hi all

i would like to let users make partial searches on my documents. let me
explain

i have a site in which i have some documents to store information like
title, category, number of pages, contents and so on. i want to make some
part of my documents invisible to users. 
lets say i have 100 documents but for some fields on some documents, user
should log in to make a search, otherwise the field will be disabled for
search, but still the other fields will be visible for search... 

i am not sure if i am clear enough so i wilk try to give you a detailed
exampe

                                  doc1            doc 2          doc3      
doc4
title                               X               "Y"               T           
Z
category                       "A"              K                 U         
"S"
number of pages            4                6                 9            1 
content                  "some text"      text           letter      "text
here"


so in this case values with quotes are hidden for users who didnt login to
site.
   lets say a non-logged user makes a search in content field with query
text, i want him to see only doc2 in the serach results. however if a users
logs in before search and makes the same search, i want him to see doc1 doc2
and doc4 in the result list...

so to implement this feature, what should i do? i have some ideas like
adding a control statement before showing the results on php side but i am
concerned about search time as the total number of documents is a large
number.

any ideas?


-----
Zeki ama calismiyor... Calissa yapar...
--
View this message in context: http://lucene.472066.n3.nabble.com/searching-documents-partially-tp3408429p3408429.html
Sent from the Solr - User mailing list archive at Nabble.com.

RE: searching documents partially

Posted by pravesh <su...@yahoo.com>.
Just follow the  http://wiki.apache.org/solr/DisMaxQParserPlugin dismax wiki 

You just need to:
1. Duplicate the dismax request handler entry in your solrconfig.xml
2. change the name to some other unique name for e.g. "notLoggedDismax"
3. set the /qf /fields to you /content_dup/ field (or other common fields)
4. Then from your front-end app you have to make sure for not-logged-in
users use use the notLoggedDismax for your searches otherwise use the
default dismax

>and as another idea, if i use different indexes, is it possible to make
search on them? or is it possible to define the index which i will be making
a search in, in query time? 

Then you are just duplicating the index and you might stuck-up in
maintenance issues

Thanx
Pravesh

--
View this message in context: http://lucene.472066.n3.nabble.com/searching-documents-partially-tp3408429p3411743.html
Sent from the Solr - User mailing list archive at Nabble.com.

RE: searching documents partially

Posted by deniz <de...@gmail.com>.
Brandon Ramirez wrote:
> 
> I may not be understanding the question correctly, but I think the dismax
> parser would solve this since you can specify the fields that you want to
> search against.  So you just need a pre-login field list and a post-login
> field list in your application logic.  Or like pravesh suggested, create
> multiple search handlers in solr and give each a different set of default
> or mandatory field list.
> 
> 
> Brandon Ramirez | Office: 585.214.5413 | Fax: 585.295.4848 
> Software Engineer II | Element K | www.elementk.com
> 
> 
> -----Original Message-----
> From: pravesh [mailto:suyalpravesh@] 
> Sent: Monday, October 10, 2011 5:32 AM
> To: solr-user@.apache
> Subject: Re: searching documents partially
> 
> Can you clarify following:
> 
> 1)  Is it that: You want to hide some documents from search when user is
> not logged-in?
>  OR
> 2)  Is it that: You want to hide some fields of some documents from search
> when user is not logged-in?
> 
> For Point 2; one solution can be that while indexing the documents, you
> can re-index same field(s) twice. Lets say; /content/ & /content_dup/.
> (Similar treatment can be given to other fields, which requires this
> restriction)
> 
> At the index time you set /content/ for all documents, but set
> /content_dup/ only for documents/fields which you want to appear in search
> when user is not logged-in.
> 
> At search time, when user is not logged-in then search on the
> /content_dup/ field, and when user is logged-in then search on the
> /content/ field.
> 
> 
> Another way could be:
> 
> Just register your search-handler with another name and change the default
> search fields etc.
> 
> I don't know that much this helps :)
> 
> --
> View this message in context:
> http://lucene.472066.n3.nabble.com/searching-documents-partially-tp3408429p3409022.html
> Sent from the Solr - User mailing list archive at Nabble.com.
> 



@pravesh: I want to hide some fields from non-logged users, and thank you
for your response.

i was thinking of adding a duplicate field too but then i got confused when
i think about default search field... if my default search field is content
field, then how to make a search in content_dup fields at the same time? i
guess brandon's idea can work here but i dont know how to use dismax so if i
am missing some point here, any explanation would be welcomed... 


and as another idea, if i use different indexes, is it possible to make
search on them? or is it possible to define the index which i will be making
a search in, in query time?

-----
Zeki ama calismiyor... Calissa yapar...
--
View this message in context: http://lucene.472066.n3.nabble.com/searching-documents-partially-tp3408429p3411281.html
Sent from the Solr - User mailing list archive at Nabble.com.

RE: searching documents partially

Posted by Brandon Ramirez <Br...@elementk.com>.
I may not be understanding the question correctly, but I think the dismax parser would solve this since you can specify the fields that you want to search against.  So you just need a pre-login field list and a post-login field list in your application logic.  Or like pravesh suggested, create multiple search handlers in solr and give each a different set of default or mandatory field list.


Brandon Ramirez | Office: 585.214.5413 | Fax: 585.295.4848 
Software Engineer II | Element K | www.elementk.com


-----Original Message-----
From: pravesh [mailto:suyalpravesh@yahoo.com] 
Sent: Monday, October 10, 2011 5:32 AM
To: solr-user@lucene.apache.org
Subject: Re: searching documents partially

Can you clarify following:

1)  Is it that: You want to hide some documents from search when user is not logged-in?
 OR
2)  Is it that: You want to hide some fields of some documents from search when user is not logged-in?

For Point 2; one solution can be that while indexing the documents, you can re-index same field(s) twice. Lets say; /content/ & /content_dup/. (Similar treatment can be given to other fields, which requires this restriction)

At the index time you set /content/ for all documents, but set /content_dup/ only for documents/fields which you want to appear in search when user is not logged-in.

At search time, when user is not logged-in then search on the /content_dup/ field, and when user is logged-in then search on the /content/ field.


Another way could be:

Just register your search-handler with another name and change the default search fields etc.

I don't know that much this helps :)

--
View this message in context: http://lucene.472066.n3.nabble.com/searching-documents-partially-tp3408429p3409022.html
Sent from the Solr - User mailing list archive at Nabble.com.


Re: searching documents partially

Posted by pravesh <su...@yahoo.com>.
Can you clarify following:

1)  Is it that: You want to hide some documents from search when user is not
logged-in?
 OR
2)  Is it that: You want to hide some fields of some documents from search
when user is not logged-in?

For Point 2; one solution can be that while indexing the documents, you can
re-index same field(s) twice. Lets say; /content/ & /content_dup/. (Similar
treatment can be given to other fields, which requires this restriction)

At the index time you set /content/ for all documents, but set /content_dup/
only for documents/fields which you want to appear in search when user is
not logged-in.

At search time, when user is not logged-in then search on the /content_dup/
field, and when user is logged-in then search on the /content/ field.


Another way could be:

Just register your search-handler with another name and change the default
search fields etc.

I don't know that much this helps :)

--
View this message in context: http://lucene.472066.n3.nabble.com/searching-documents-partially-tp3408429p3409022.html
Sent from the Solr - User mailing list archive at Nabble.com.