Closed (fixed)
Project:
Apache Solr Search
Version:
6.x-2.0-alpha2
Component:
Code
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
17 Mar 2010 at 17:20 UTC
Updated:
9 Mar 2012 at 16:35 UTC
I've been trying to do a search solely based on the node title, I dont want to search the the rendered body; is this possible?
I know node->title is indexed by default and is available as a sort by facet but that is not enough.
Any help/insight into this would be helpful.
Comments
Comment #1
Scott Reynolds commentedjust need to change the search fields in the interface to just title admin/settings/apachesolr/query-fields. Same is true for Apache Solr Views as well ;-)
Comment #2
flk commentedHi Scott thanks for pointing that out, I have been trying to modify the query field using the hook_apachesolr_modify_query
but for some reason that does not seem to work; having traced how the 'search fields' are stored I thought maybe setting my own fields in the following manner might do the job
Which worked but isn't really what i had in mind, I want to be at a given search page be able to search given fields (basis for query builder?) but when i come back to the main search the fields are back to the default 'search fields' settings
Am I even using the right hook?
Comment #3
Scott Reynolds commentedIf you need to do it conditionally, I believe only Views solution is there for you because it is the only solution that provides multiple pages. And as if I understand this:
That is what you are talking about. And Apache Solr Search Integration provides only one page (search/apachesolr_search), so your little jab about basis for a query builder kindof bounces off ;-).
Apache Solr Views exposes a couple member functions add_boost_function, add_boost_query and add_query_field.
So you can do this with Views
That should be all you need, just create your View with one field Node Title.
Comment #4
flk commentedYou've been tremendous help thank you :)
You're are right that views easily provides multiple pages search, since there are no easy way of doing it.
I would like to if it is possible assist in trying to get this functionality into the UI where would you suggest I start things from?
PS your code worked like a charm.
Comment #5
flk commentedComment #6
Andreas Radloff commentedI have created a sandbox project module for searching only in specific cck fields, support for title will be added in the future.
http://drupal.org/sandbox/AndreasRadloff/1474818
Comment #7
nick_vh6.x-2.x is not supported. I hope your module will also support 6.x-1.x or at least 6.x-3.x?
Comment #8
Andreas Radloff commentedCircumstances forced me to choose 2.x for this client project (I needed some of the modules available only for 6.x-2.x). I'm aiming for a 6.x-3.x / 7.x version sometime soon, but as I understand it a lot has changed so I suppose I will need to do a lot of rewriting...