Closed (works as designed)
Project:
Apache Solr Search
Version:
7.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
28 Oct 2011 at 17:47 UTC
Updated:
18 Apr 2012 at 15:08 UTC
Jump to comment: Most recent file
Comments
Comment #1
nick_vhIt is certainly possible to do this.
Example :
Comment #2
danny_joris commentedThanks - I don't really see the context of this snippet yet, but nice to see it is possible. I'll do some research.
We could be working with cases with up to 10 different requestHandlers and up to 200 different custom fields. We don't need to store drupal content at all, but if so, would it be advisable to combine our custom data with drupal data in one solr table or is it possible to address 2 solr instances?
Would using the apachesolr module bulk the code to achieve this result?
Comment #3
nick_vhMy bad, I didn't completely pasted the snippet. This is querying the statistics from a field but you can do that with other filters and parameters.
Comment #4
nick_vhOh, and apachesolr 7.x-1.x allows you to have multiple solr environments/instances. So you can fetch the solr that is appropriate to you. Please dive into the code to get a better understanding I'd propose.
If you have more specific question, don't hesitate to ask!
Comment #5
nick_vhComment #7
danny_joris commentedMind if I re-open this as it's related to the same custom solr index? (and I finally found time to explore this further)
So I've been playing around a bit with both the D6 and D7 version. In the D7 version I can point to our custom solr instance. I've been checking most of the DrupalApacheSolrService methods and I'm able check luke successfully, which is a good sign. I'm still unable to perform a successful query on the normal search results. It's because the way we set it up is using requestHandlers defined in solrconfig.xml. I managed to get the right results by calling
<?php $solr->search('myQuery', array('qt' => 'standard', 'defType' => 'dismax')); ?>programatically. Is there a way we can select a requestHandler and defType (always dismax in our case) for the default search results? Also it still limits the results by 10 - I don't know where that's defined. How does apachesolr handle this? Does it use dynamic requestHandlers? It seems to just return every field?The islandora_solr_search module search results are pluggable, meaning you can create a custom module that hooks into islandora_solr_search, which you can use to leverage a custom display. (lists, solr results on maps etc.. based on the same solr query) I would assume we can use 'multiple displays' in apachesolr by creating multiple solr environments that point to the same solr instance. How would we theme/render the output of these different displays? Can we hook into it to preprocess the data?
If I'm able to pull out the solr results, I assume I can hook into the facet api to leverage our own facets? Probaby using the snippet you provided earlier in this tread?
In islandora_solr_search we're able to use a 'simple search' which performs a query from one textfield which uses a defined requestHandler and dismax. We also have a second form that doesn't use dismax, but instead performs queries directly on specific solr fields. It would have a dropdown for every textfield which sets the solr field to search on and it has an AND/OR dropdown between query strings (see attachement). Is this kind of form available in apachesolr too?
Thanks!
Danny
Comment #8
danny_joris commentedComment #9
danny_joris commentednot sure what happened there.
Comment #10
danny_joris commentedI'm still trying to pull the right data from my solr index. I created a custom module with this hook_apachesolr_query_alter() function:
Adding dismax does return the correct number of results, but all results are empty (just 3 dots: ...). The pager does get rendered correctly.
It also throws this error for every result on the page:
Notice: Undefined property: stdClass::$id in apachesolr_search_process_response() (line 1163 of /home/quickstart/websites/example.dev/sites/all/modules/apachesolr/apachesolr_search.module).or
Notice: Undefined property: stdClass::$entity_type in apachesolr_search_process_response() (line 1176 of /home/quickstart/websites/example.dev/sites/all/modules/apachesolr/apachesolr_search.module).Which makes me think that even in the search results it's assuming drupal specific content.
Comment #11
nick_vhWhy would you want to change the query type? I don't see the advantage since this is a lesser version than edismax. Edismax is enabled by default.
Comment #12
danny_joris commentedI didn't know Edismax was enabled by default. I can't return anything with it. Would I need to update our schema.xml or solrconfig.xml? Or do I need a different query?
Seems like edismax is only available in solr 3.x? I'm trying to access a solr 1.4 instance.
Does dismax vs edismax have anything to do with the errors that are thrown?
Comment #13
danny_joris commentedThe standard requesthandler in solrconfig.xml of the sample data is :
Comment #14
nick_vhI'm mistaken! My bad. It is possible to enable edismax more easily but it is not default. Dismax is.
So you should also not set it in your query object :-)
Comment #15
danny_joris commentednp - so dismax can be triggered without it being in the solr query? It seems like this is the GET request that gets called. It's what the SolrBaseQuery->solr method returns.
/solr/select?start=0&rows=10&spellcheck=true&q=california&fl=id,entity_id,entity_type,bundle,bundle_name,label,is_comment_count,ds_created,ds _changed,score,path,url,is_uid,tos_name,mods_title_s,mods_topic_s,PID,pid,nid ,tm_node&spellcheck.q=california&wt=json&json.nl=mapDismax isn't included in this request and it also doesn't return anything from my solr instance (because dismax isn't included?)
Sorry for all the questions.
Comment #16
nick_vhDismax is already set in the solrconfig.xml
Comment #17
danny_joris commentedOdd - because it's also set in the solrconfig.xml of our solr instance. I'll look into it.
Issue remains that when I do add the dismax defType parameter, I can pull the results, but the rendering goes wrong. It would be really awesome if we could pull our custom data, but it seems like there are a lot of drupal-specific calls and checks.
Comment #18
nick_vhComment #19
danny_joris commentedFair enough.
Comment #20
nick_vhJust as a last comment :
drupal.org/project/sarnia
This is meant to read out fields that are non-drupal.