Closed (fixed)
Project:
Search API Solr
Version:
7.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Reporter:
Created:
7 Jan 2013 at 15:21 UTC
Updated:
16 Sep 2013 at 10:51 UTC
Jump to comment: Most recent file
Comments
Comment #1
corvus_ch commentedHere is a path that allows to exactly this either on a global or per index level.
Comment #2
corvus_ch commentedHere is an updated version that also prefixes the id in a more like this query.
Comment #3
corvus_ch commentedPatch did not apply anymore. Reroled.
Comment #4
drunken monkeyI don't think we need per-index prefixes – after all, they'll already have different machine names. Or do you see/have a use case for this?
That said, the idea does make sense. If you only have one Solr server, but both production and development servers, this would probably be the easiest solution for having Solr for both.
Please also correct the following:
getIndexId()public, and always pass the machine name instead of the complete object.Comment #5
corvus_ch commentedThanks fo the review.
Yes I do have a use case. Imagine a site that has more than half a million indexed node. Adding a global prefix just because you ad one more index that might colide with other sites using the same Solr is not what you actually want to do. I agree that the use case is rare and probably other solutions exits but I like to have the option and actually it does not hurt to have both.
Improvements will follow.
Comment #6
arnested commentedI updated the patch based on @drunken_monkeys comments in #4.
I fixed a few minor code style issues in the new getIndexId() method.
I also renamed the variables from "search_api_solr_prefix" to "search_api_solr_index_prefix". I think adding "index" makes the names more precise.
I also backported the patch to 7.x-1.0-rc2 for those people stuck on that version (guess who's currently stuck ;-)
We need the patch for handling several development environments using the same Solr server.
Comment #7
drunken monkeyI'm pretty sure you should replace
$index->machine_nametwo lines above instead of that line.Also, while the README.txt addition is pretty good already, it should contain a warning to only use alphanumeric characters and underscores, and a note to clear the index (or, better still, temporarily remove it from the server entirely) right before changing the variable. Otherwise, if you only re-index, the old data might be in there indefinitely.
Comment #8
arnested commentedYou're right. I have changed the right occurrence of
$index->machine_nameinstead.I also added the warnings to the README.
New patch attached (and still a backport to 7.x-1.0-rc2 for those of us stuck in the past).
Comment #9
drunken monkeyThanks, this seems perfect. Committed.
Comment #10
arnested commentedCool. Thank you.