Using Solr for multiple sites - asp.net

I have setup a Solr server, now, I have two sites that I want to index and search using SolrNet.
How do I differentiate the two sites' content in Solr?

You may want to take a look at this document: http://wiki.apache.org/solr/MultipleIndexes
I think the best approach is to use Multiple Solr Cores.

Another option is you can simply add a new field that indicates the item's Web site. For example, you can add a field called type.
Searches on website1.com would require you to filter on the type field.
&fq=type:website1.com
That way you only need to deal with one core and one schema.xml file. This works if the pages of both sites have a very similar field set, and it will make it easier to search across both sites if you plan on doing that.
http://wiki.apache.org/solr/MultipleIndexes#Flattening_Data_Into_a_Single_Index

Related

MYSQL based FulltextSearchable With Elemental blocks

Is it possible to use the mysql based fulltextsearchable functionality to search elemental blocks content?
Elemental has integration features with Solr, but I'm working on a few sites that are too small to justify running a server instance for search.
The DNADesign\Elemental\Extensions\ElementalPageExtension provides a getElementsForSearch() method which is the elemental blocks concatenated and includes some configuration to customise it.
For this to work in a database-based search you'll need to store that (or something like it but why re-invent the wheel?) in the database. You can do this by declaring a new db field on the page and then using something like onBeforeWrite() on the page to actually store the data.
Be aware that you can save and publish blocks separately to the page though, which will complicate matters somewhat and could lead to stale data depending on how you handle this.
Yes MySql full text search is efficient and reliable, just concatenate your blocks in a text column separated by spaces and index this column.
Avoiding using a search server like Solr should save you lots of pain.

Several WordPress sites to share plugin data

I am wondering if there is a way to have two WordPress installations with separate databases or table prefixes, but install a plugin and use data generated by it on both websites.
For example, if I hade website1.com and website2.com. Website1 has s1 table prefix, Website2 has s2. At this point, they are still two separate websites.
Now, I'd like to install a plugin which, of course, comes with its own set of tables and whatnot. Is there a way to share that data between these two websites? Make s2 point to s1 tables just for this purpose, or create a third prefix and point both websites to it?
Or is there a completely different approach I'm not thinking of? Is this at all possible?
Possible? Yes, absolutely. The plugin could create its own database table and both sites would need to query this table to get whatever data they need from it.
The how-to-do-it part is up to you. Writing a plugin that creates a database table isn't difficult (in your case, you don't want it to use the prefix of either of your sites to make it evident that this plugin's database table is site-independent). Check the official documentation, there's a working example there on how to create a database table on plugin activation. Now, having your two sites get data from it is where the fun begins and that is also up to you to sort out. The $wpdb object will be useful in this particular case.
And yes, you can have two WordPress sites share the same database without using multisite. Just make sure both setups are on separate folders and that each site uses their own database table prefix and you're good to go.
Happy coding!

Search multiple plone site indexes

I need to implement a central search for multiple plone sites on different servers/machines.If there is a way to select which sites to search would be a plus but not the primary concern.Few ways I came upon to go about this:
-Export the ZCatalog indexes to an XML file and use a crawler periodically to get all the XML files so a search can be done on them,but this way does not allow for live searching.
-There is a way to use a common catalog but its not optimal and cannot be implemented on the sites i am working on because of some requirements.
-I read somewhere that they used solr but i need help on how to use it.
But I need a way to use the existing ZCatalog and index and not create another index as i think is the case with using solr due to the extra overheads and the extra index required to be maintained.But will use it if no other solution possible.I am a beginner at searching so please give details as much as possible.
You should really look into collective.solr:
https://pypi.python.org/pypi/collective.solr/4.1.0
Searching multiple sites is a complex use case and you most likely need a solution that scales. In the end it will require far less effort to go with Solr instead of coming up with your own solution. Solr is build for these kind of requirements.
As an alternative, you can also use collective.elasticindex, an extension to index Plone content into ElasticSearch, for this.
According to its documentation:
This doesn’t replace the Plone catalog with ElasticSearch, nor
interact with the Plone catalog at all, it merely index content inside
ElasticSearch when it is modified or published.
In addition to this, it provides a simple search page called
search.html that queries ElasticSearch using Javascript (so Plone is
not involved in searching) and propose the same features than the
default Plone search page. A search portlet let you redirect people to
this new search page as well.
That can be and advantage over collective.solr.

How to handle non tabular data?

I have site terms, about and contact modules on my website. I want to be able to change these items via CMS and not via changing .ASPX pages every once in a while. My question is how to store this data ? I used to store this kind of data in SqlServer but i always thought it is an overkill since data is a single row with different columns especially when in some cases i just need one column.
How do you handle this issue ?
I have used a poor-mans CMS in the past for this type of thing by reading an xml file, however, Umbraco is an excellent CMS you may want to look at.

Module Multi-instance in OrchardCMS

assuming i have a contacts orchard module which manages contacts
can i have two instance like so
mysite.com/WorkContacts/...
mySite.com/HomeContacts/....
and have the data partitioned by instance/location type etc.
I assume it should be but want to be sure before i dig any deeper
It's not possible by default (although I'm not saying impossible at all).
Each module has it's unique, hardcoded Id which prevents multi-instancing of modules by design. There are also many other reasons why it wouldn't be a good idea...
Achieving such behavior is possible of course, but in slightly different way. As Orchard is mainly about content, you are free to build your own, different content types for different contact types from existing parts and fields. And then you're free to create instances of those. It's described very well here.
HTH
This would probably be better asked over on the Orchard sites.
If you look at blogs functionality you can have multiple of those, following a similar pattern of code you could have multiple of the contacts modules.
The path /HomeContacts ... etc would be set through the routing functionality of Orchard.
I think what you're looking for might the multi-tenancy module, available from the gallery. The only difference with what you describe is that the instances would need different server names rather than subfolders like you decribed.
Then again it's not quite clear whether you only want to separate just the data for that module (in which case the suggestion to model it after blog is a good one) or for the whole site (that would be multi-tenancy).

Resources