Integrating and Customizing Keyoti Search within Advantage CSP
Advantage CSP seamlessly incorporates Keyoti Search as its default search solution, enabling a powerful search feature right out of the box. However, if your project demands a different search capability, Advantage CSP is flexible enough to accommodate alternative search appliances, including popular options like Elastic, Lucene, Azure Search, and Google Search.
Setting Up Keyoti Search
Initial Configuration
When launching a new website, it's crucial to initiate the search indexing process. Keyoti Search automates this by crawling and indexing the primary URL defined in your webmaster's domain tool. This ensures that your site's content is searchable right from the start.
Web.config Adjustments
To configure Keyoti Search, modify your web.config file with the following settings:
License Key: Include your unique Keyoti Search Engine license key to activate the search functionality.
Meta Keyword Weight: Adjust the importance of meta keywords in search rankings.
Meta Description Weight: Set the significance of meta descriptions for search relevance.
Customizing Keyoti Search Appearance
Pagination Styling Challenges
A known limitation with Keyoti's pagination is its output format, which presents a string of page links. This default presentation doesn't separately highlight the currently selected page, making direct CSS styling of the active page indicator challenging.
Styling Solution
To introduce styling capabilities, especially for the current page in pagination, you can manipulate the pagination string on the front end. By passing Container.PageLinksBlock to a custom formatting method, you can inject HTML tags around the page numbers, enabling individual styling.
Example Implementation
Consider the following markup structure to apply your custom pagination styling:
Use the following method to format the page links, employing a Regex pattern to identify and wrap numbers (representing page links) in a span tag for easier styling:
{638477365300504519}
Styling the Pagination
After wrapping the page numbers in span tags, apply your desired CSS styling. For instance, to make the pagination numbers stand out, you might choose a vibrant color like lime for the spans within the .pagination-adv list:
This approach not only enhances the functionality of Keyoti Search within Advantage CSP but also ensures a seamless and visually appealing user experience.
Implementing Geospatial Search with Advantage CSP
Advantage CSP now supports the integration of geospatial search capabilities, enhancing the user experience for applications requiring location-based searches. This functionality is perfect for a variety of applications, including store locators, classified ads, and vacation rental listings. In this guide, we'll demonstrate how to incorporate geospatial search into a simple job listing website, showcasing only those positions within a specified radius of the user's location. This tutorial will provide a foundational understanding of implementing geospatial search features with SearchUnit.
Initial Configuration
For demonstration purposes, we've prepared a basic ASP.NET web application and integrated SearchUnit.
To facilitate indexing, we've created simple HTML pages representing various job listings, each linked together to assist the crawler in indexing the content efficiently.
Incorporating Geolocation Data
To enable geospatial searches for job listings, it's essential to embed latitude and longitude information within the job pages. This can be achieved by adding a specific meta tag for Custom Data on each page:
Following the inclusion of geolocation data, the next step involves creating the index. For simplicity, our HTML job pages are stored within the application, allowing for straightforward indexing through a web import using the Index Manager tool once the webserver is operational.
Implementing the Geolocation Filter
To add a geolocation filter to your search page, insert the following HTML. This filter provides users with a dropdown menu to select the search radius:
Integrating a Geocoding Service
For users to enter locations in free text, integrate a geocoding service such as Google's Places API with the following script, allowing for dynamic location-based searches:
Replace "YOUR_GOOGLE_API_KEY" with your own to ensure functionality outside of localhost environments.
Finalizing the Setup
Add the search box control to facilitate user queries and the search result control to display the findings, complete with sorting and geospatial filtering options:
Finally, specify the index directory path for your job site index, enabling SearchUnit to access and query your geospatial data effectively:
With these steps, Advantage CSP users can now leverage the power of geospatial search to enhance their web applications, offering location-based search functionalities. For more advanced customizations, such as adding mapping features, please refer to the demo projects provided with SearchUnit or reach out for further assistance.
Advantage CSP: Programmatic Index Management with SearchUnit
Advantage CSP: Programmatic Index Management with SearchUnit
Advantage CSP includes SearchUnit, offering a comprehensive index management tool for handling various aspects of the index, including document importation from diverse sources. While the graphical Index Management tool is intuitive for most tasks, there are instances when direct programmatic interaction with the index is preferable. This might include incremental addition or removal of documents, among other operations.
Programmatically Importing Sources
Importing a source—whether a website, file system folder, database, or DataSet—entails scanning for and indexing all eligible documents based on specified criteria. Programmatic reimportation triggers a rescan of the source to capture updates or, if necessary, reindexes everything.
C# Example for Various Imports:
Website Import:
File System Folder Import:
Database Import:
Custom DataSet Import (from an assembly:
Always close the documentIndex after operations to ensure proper resource management.
Adding Individual Documents
For incremental updates to the index as new documents become available, you can add documents one at a time.
Note: The completion time for Add Document varies. It's recommended not to use this method in web applications where immediate page response is required.
Asynchronous Document Addition
To avoid delays in web applications, documents can be queued for background indexing using the AsynchronousQueue class.
C# Example for Asynchronous Addition:
For database-originated documents, recreate the URI based on the IndexableSource ID and unique field.
Adding Data as Strings
For scenarios where data doesn't reside in traditional documents—like indexing extra descriptions or database content—use the PreloadedDocument class.
C# Example for PreloadedDocument:
To remove a PreloadedDocument, use the RemoveDocument method with the same URI used during creation.
By leveraging these programmatic capabilities, users of Advantage CSP can enhance their SearchUnit index management, tailoring it to their specific requirements for efficient and dynamic content indexing and updating.
Integrating SearchUnit Search Services in Mobile Applications
This guide details how to harness SearchUnit search web services for mobile platforms including Android, iOS, and Windows. Particularly, we focus on setting up an Android search interface, noting that the process remains largely similar across other platforms.
Prerequisites
- SearchUnit Deployment: Your server must have a web application running with SearchUnit deployed and a searchable index available.
- Downloadable Project: An Android project and an MVC server-side project are provided. The MVC project, while basic, contains the SearchService.svc in the Keyoti_SearchEngine_Web_Common folder, managing incoming calls from the mobile client.
Important Setup Notes
- SearchUnit DLLs: The MVC project needs the SearchUnit DLLs. Install these via MSI, manually into the GAC, or by copying them to the project's BIN and referencing them there.
- IIS Hosting: The MVC project requires IIS for hosting since only IIS can serve remote machines. IIS Express and the developer webserver do not support remote access.
- Administrator Privileges: Open the MVC project with administrator privileges due to IIS hosting requirements.
- License Key: Ensure you have a valid license key for the search engine. A temporary key in the web.config may need replacement if expired.
- Android Project Setup: The Android project (Android Studio) should have the server address configured to point to the machine running the SearchUnit6-ServiceExample web application. Adjust the serverAddress field in SearchActivity.java accordingly. Remember, localhost addresses won't work with Android emulators as they run on separate (virtual) machines.
Operation Overview
This setup uses JSON for packaging request data and interpreting the JSON response from the SearchUnit service. The primary task involves creating an interface to the search service, initiating service requests, and handling responses.
Code Snippet: Android AsyncTask for Search
An AsyncTask class named SearchTask encapsulates the process from sending the search query to displaying the results. The task constructs a JSON object for the request, posts it to the search service, and processes the JSON response.
This simplified overview abstracts details like request construction and response parsing, focusing on the asynchronous task's structure. The task:
- Constructs a service request URL and parameters as a JSON string.
- Sends the request using HttpPost.
- Logs the response and converts it to a JSON object for processing.
- Extracts search results from the response and populates them into a list for display.
Integration Steps
Configure the Server Address: Ensure the Android project's serverAddress points to your server.
Handle Search Requests: Implement doInBackground to construct and send search requests.
Process Search Responses: In onPostExecute, parse the JSON response, extracting search results for display.
By following these steps and considering the important setup notes, developers can effectively integrate SearchUnit's search capabilities into their mobile applications, enhancing the user experience with powerful server-side search functionalities.
Related Guides: