MongoDB Collection
A MongoDB collection can be created using the following steps:
Creating MongoDB Collection
- After logging in to the Admin Console, click Add Collection button. The Add Collection screen will be displayed.
- Enter a unique name for your collection (for example, MongoDB).
- Select MongoDB collection radio button.
- Click Add to create the collection.
MongoDB Collection Settings
- The Settings sub-tab holds collection settings for MongoDB and tunable parameters for the search.
- MongoDB settings values must be set explicitly for MongoDB collections.
- The mandatory settings for MongoDB collection are
- Host Name
- Port Number
- MongoDB Type
- MongDB Database Name
- MongoDB Database Collection
- SearchBlox also comes pre-configured with few parameters when a new MongoDB collection is created which can be modified as required.
- The following table has the list of settings available in MongoDB collection
Field | Description |
---|---|
Host Name | IP address or name of the MongoDB host (default value is localhost). |
Port Number | Port number of MongoDB. |
MongoDB Type | Default value is local. |
User Name | User name in MongoDB (leave the username and password fields empty if no username is available). |
Password | Password used in MongoDB. |
MongoDB Database Name | Database name to be indexed. |
MongoDB Database Collection | Collection to be indexed. |
Bulk Size | The number of documents(BSON documents) to be taken at a time for indexing. |
Keyword-in-Context Display | The keyword-in-context returns search results with the description displayed from content areas where the search term occurs. |
Boosting | Boost search terms for the collection by setting a value greater than 1 (maximum value 9999). |
Stemming | When stemming is enabled, inflected words are reduced to root form. For example, "running", "runs", and "ran" are the inflected form of "run". |
Spelling Suggestions | When enabled, a spelling index is created at the end of the indexing process. |
Steps to Set Up MongoDB for Searchblox Indexing
Steps for setting replica and oplog in MongoDB:
- Start MongoDB with the command mongod:
mongod --replSet rs0 --oplogSize 100
- Start MongoDB with the command mongo and run:
> show dbs
local (empty)
> use local
switched to db local
> rs.initiate()
{
"info2" : "no configuration explicitly specified -- making one",
"me" : "MONGOSERVER:27017",
"info" : "Config now saved locally. Should come online in about a minute.",
"ok" : 1
}
> show collections
oplog.rs
system.replset
rs0:PRIMARY>
- Create collections in MongoDB with settings:
dbtype : local
dbname : <database name>
collection name: <collection name within local>
Indexing and Other Operations
The following operations can be performed in a MongoDB collection:
Activity | Description |
---|---|
Index | Starts the indexer for the selected collection. |
Clear | Clears the current index for the selected collection. |
Scheduled Activity | For each collection, any of the following scheduled indexer activity can be set: Index - Set the frequency and the start date/time for indexing a collection. Clear - Set the frequency and the start date/time for clearing a collection. |
- Indexer activity is controlled from the Index sub-tab in the collection. The current status of an indexer for a particular collection is indicated.
- Indexing operation starts the indexer for the MongoDB collection.
- On reindexing that is, clicking on index again after the initial index operation, all crawled documents will be reindexed. If documents have been deleted from MongoDB since the first index operation, they will be deleted from the index. New documents will also be indexed.
- Also, indexing is controlled from the Index sub-tab for a collection or through API. The current status of a collection is always indicated on the Collection Dashboard and the Index page.
- Index operation can also be initiated from the Collection Dashboard.
- Scheduling can be performed only from the Index sub-tab.
Schedule Frequency
Schedule Frequency supported in SearchBlox is as follows:
- Once
- Every Minute
- Hourly
- Daily
- Every 48 Hours
- Every 96 Hours
- Weekly
- Monthly
Best Practices
- Please cross-check the steps to set up MongoDB in our documentation with your MongoDB admin for successful indexing of collection
- Specify the correct and relevant settings of MongoDB in the MongoDB collection settings
- Do not schedule the same time for index and clear operations
- If you have multiple collections, always schedule the activity to prevent more than 2-3 collections indexing at the same time.
Updated about 4 years ago
What’s Next