Hi,

I am asking this question for the Apache Solr Module Developers and i wanted to know if any work has been done previously on this kind of work.

I wanted to create a content-type (which has several fields and solr query box is one of those fields) and when the node page is created a query should be made based on the input and the search-results should be displayed as a field rather than displaying them in the whole page. The appropriate facets should also be created on left or right side, when the page is created.

Just a simple example would be in this page (http://nick.dlib.vt.edu/drupal/?q=node/114#) where an implicit query is made and the results are shown as a part of a field. Other fields can also be present for the content-type. I wrote my own field module which queries Solr using (SolrPhpClient) and shows the results. This simple module does not use apache-solr module.

I would like to know how apache-solr module can be used to create something like this. So when the implicit query is made, results and facets should be shown.

I am new to drupal but i am learning to write custom code as per my requirements. I have worked with Solr for one year and i index my huge content remotely using my own scripts. I have changed the configuration files in the way it works for indexing drupal content and also my remote data.

I think this can be made possible using apachesolr module but i would like to have few inputs on how this can be done without much work. I can write custom code for this kind of work but i would like to use the api and apache solr hooks.

Please tell me what to do you think.

Sorry for a long post.

Many Thanks

Comments

cpliakas’s picture

Hi kiran chitturi.

You might be able to leverage the apachesolr_do_query() API function, which will execute a Solr query and initialize the facet building stuff so you can display facets. To see how to build the query object, take a look at the Solr_Base_Query.php file. Regarding the field integration, that is definitely outside the scope of this module, however the API functions above should allow you to use this module instead of the SolrPhpClient library.

Taking a step back, though, why are you doing this as a field in a node? In other words, what is the node giving you that drove you to choose this architecture? There could be some other ways to accomplish what you are looking to do without having do a lot of (if any) coding.

Thanks,
Chris

kiranch@vt.edu’s picture

Hi Chris,

Many Thanks for your reply. I have been waiting hear back from drupal community.

I will give you an example on why i want this as a field in a node,

  • I use apache solr in our research lab for indexing lot of HTML documents and their metadata remotely. I want to display that metadata in the user interface using drupal. Those search results will be displayed as a part of content-type, along with other fields. I have used SolrPhpClient to query Solr and produce the results on the interface but i would also like to have the facets displayed. I was going to write my own module for this(that would take more time) but i thought since apachesolr module does most of this work (displaying search results and facets), i could use this module to do that work.
  • I have changed the schema.xml and solrconfig.xml in a way that they can be used by drupal and also for me to be able to index different kinds of data remotely.
  • So here is a wireframe of my work (http://i.imgur.com/a2wuu.png). We have a lot of Crisis, Tragedy and Recovery (CTR) Events which look similar to one of the event show in the wireframe. As shown, there is a field called webpages as one of the fields in the content-type, the values of the results come from Solr and can be filtered through facets. So, to make this possible i am thinking of doing an implicit query (from one of the fields when content-type is created) as said before and display facets, results. When the content-type page is created by the admin, solr is queried and results are displayed. This is my plan for now.
  • I thought since apachesolr module does most of this work, i could use that instead of writing my own code to do things since apachesolr is also a standard module. I was looking in to the api and trying to figure out how i can send a custom query to it and get the results
  • I have done one small prototype to have a wireframe like that (http://nick.dlib.vt.edu/test2/). I have used views for that. So what i have done there is, make different nodes (images, videos, map, profile, webpages) and show all of them using views. For the webpages i have used a custom module as said before (using SolrPhpClient) but it does not have facets working. Do you think a search-result page along with facets, can be used with views to show something similar to my wireframe ?

I have started learning drupal for this project, and i have been working hard to learn how things work in drupal. I have not tried looking in to Search API Solr search, do you think it would be useful to play with ?

If you have any suggestions, i would like to know :)

Thanks again, for the response.

Sorry for the long post, i thought i could give more clear details of my work.

nick_vh’s picture

Version: 7.x-1.0-rc2 » 7.x-1.x-dev

Im not really sure what the real question is here? It does sound like you have an interesting project going on there :)

Can you clarify where you are still stuck?