Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
This is a spinoff from #1064884: Add support for indexing non-entities
In order to use data from apachesolr (data that Search API didn't write), I need to be able to get information about what fields the Solr/Lucene index is storing.
Apache Solr provides this functionality with the "luke" servlet.
I've been working in a branch called 'party-integration' in a clone of search_api_solr on github: https://github.com/palantirnet/search_api_solr -- my initial patch is in commit ed4aae.
Comment | File | Size | Author |
---|---|---|---|
#7 | luke_handler-1110820-7.patch | 8.84 KB | drunken monkey |
#6 | luke_handler-1110820-6.patch | 8.09 KB | becw |
#4 | luke_handler-1110820-4.patch | 6.99 KB | becw |
Comments
Comment #1
drunken monkeyLooks great, thanks! Committed.
Comment #2
becw CreditAttribution: becw commentedThanks! That was so quick!
Comment #4
becw CreditAttribution: becw commentedIn using this, I found that some revisions were necessary to make it more useful:
SearchApiSolrService::getFields()
method was fetching fromcache_get()
every time it was called. Oops.Here's a patch.
Comment #5
drunken monkeyNice addition, thanks!
A few things, though:
getFields()
really use$this->fields
when$reset
is set? In my opinion, it should then also not use the static cache. As it is,$reset = TRUE
won't have any effect if the method was called previously in the same request, which might lead to unwanted stale caches.for documenting the return values, as this is used in the rest of the module (and also, I think, in core).
Please also update the documentation for the two methods in the connection class.
Comment #6
becw CreditAttribution: becw commentedOk, here's an updated patch:
SolrField
class is in a new file.SearchApiSolrService::getFields()
method is updated--you're right, that was unintentional behavior.Thanks for the careful review!
Comment #7
drunken monkeyLooks quite good already, thanks for revising!
A few corrections still, see the attached patch:
- Properly namespace the field class as
SearchApiSolrField
.- I don't thin the cache ID needs to be a property, as it is used in only one method – removed the property.
- Some small comment fixes.
Otherwise, exemplary. ;) If you don't have any objections, I'll commit the attached patch.
Comment #8
becw CreditAttribution: becw commentedHmm, this patch isn't working for me... I must have screwed something up in #4. I'm looking into it.
Comment #9
drunken monkeyFor me, everything works fine. Did you clear the cache?
Otherwise, yes, please look into it.
Comment #10
becw CreditAttribution: becw commentedMy problems were coming from somewhere else. This patch looks good to go. Thanks!
Comment #11
drunken monkeyOK, great. Committed.