Cyphon in Fixange
Cyphon is a search engine to search for the loan details using the user input queries. we can have search on the basis of loanID’s , workflowID’s and much more. currently the below functionality only uses one sources (i.e mongodb collection ) . Broader goal is to help you to get all insights in one place.\n\nmentioned below are the core component which are used to function cyphon properly .
Note - its not completed , we have to correct the code in the LoanSearch.ts to make it work. mostly it is not able to fetch loans specific to query from db . you can experiment with LoanSearch.ts file and see how it works.
LoanSearch.ts
dir - app/server/modules/fixange/src
LoanSearch.ts enables querying loan data asynchronously. It is designed to handle multiple queries in parallel using async generators, improving efficiency and scalability. The service consists of three main components
LoanSearch.LoanService.LoanDatabase.
LoanSearch Class
The LoanSearch class extends BaseSearch to process loan search queries and yield results asynchronously.
-
Methods
-
getCapabilities(): Returns the capabilities of the loan search service.\
-
search(request: SearchRequest): AsyncGenerator<SearchCard, void, unknown>: Processes loan search queries using async generators for efficiency.- \
-
processLoanQuery(query: any, owner: Owner, index: number): Promise<SearchCard | null>: Processes individual queries for loans and formats the results.
-
LoanService Class
The LoanService class interacts with the LoanDatabase to fetch loan data.
-
Methods
fetchLoans(options :{ ids:string[],owner:Owner}): AsyncGenrator<any[],void,unknown>: Fetches loan data asynchronously in chunks.
LoanDatabase Class
The LoanDatabase class extends Collection and provides methods to interact with the loan database.
-
Methods
-
Searches the database for loans matching the query.
\
-
Cyphon.export.ts
dir - app/server/modules/fixange/cyphone.export.ts
The LoanRouter Class is designed to handle loan search requests by interacting with the LoanSearch Class. It uses the searchManager to process queries and fetch search results. This service supports asynchronous processing and integrates with MongoDB for data storage.
add cyphon service inside the package.json of respective module.
The LoanRouter class manages loan search operations and provides methods to initialize the system and handle pre-processing tasks.
-
Methods
-
async initialize(): Initializes the Loan Search service and connects to the default MongoDB database. -
async pre(method: string, message: Message): Pre-processes requests before executing methods. -
async search(message: Message): Contains the search request details.\
-
-
Workflow
Connects to the database and sets up dependencies. Processes search queries and generates a job ID. Fetches job results asynchronously and returns them.
\
Cyphon.ts
dir - app/ui/modules/quick-ui/src/api/Cyphon.ts
Provides an API interface for Cyphon-related functionalities using the XUI-Core API Provider. using async search method , executes the search operations .
LoanSearchCard.vue
This component displays a card containing loan details
dir - app/ui/modules/quick-ui/src/cards/LoanSearchCard
it uses following props
- title (Object,required) - title of the card
- loanDetails (Object, required): The loan details object to be displayed.
- excludes
- formatters(Object)
- query (String,required)
Cyphon.vue
The CyphonPage component serves as the main interface for the Cyphon application. It integrates a search bar and dynamically renders search results based on user input.
Dir - app/ui/modules/quick-ui/src/vue/cyphon/Cyphon.vue
Components
SearchBar- Allows users to input queries for search.SearchResults-Displays search results for the provided keyword.
\
SearchBar.vue
The SearchBar component is a Vue.js-based search input bar designed for querying and filtering information across various categories. It supports dynamic placeholder text rotation, a help modal for quick assistance, and used with the UniForm, UniFormInput, UniButton, UniIcon, and UniModal components.
dir - app/ui/modules/quick-ui/src/vue/cyphon/SearchBar.vue
Main sections
- SearchBox : Input field for text search.
- Help Text : Clickable text to toggle the help modal.
Props
- searchExamples : Array of example search queries for help suggestions.
- PlaceHolderTickerInterval : Time interval (in milliseconds) for rotating placeholder text.
- PlaceHolderTexts : List of placeholder texts displayed in rotation.
- SearchText : Pre-filled text in the search box.
- searchInProgress : Controls the visibility of the loading spinner icon.
Methods
- Submit(): Trigger an input event with the search query.
- startPlaceholderTicker() : Starts a timer to cycle through the list of placeholder texts at specified intervals.
- toggleHelp() : Toggles the visibility of the help modal.
SearchResults.vue
The SearchResults component displays search results based on the provided keyword input. It dynamically fetches data, updates results at regular intervals, and provides loaders, empty states, and support for custom messages.
dir - app/ui/modules/quick-ui/src/vue/cyphon/SearchResults.vue
Props
- keywords : The search query input provided to fetch the results.
- resultRefreshInterval : Time interval (in milliseconds) for refreshing results until completion.
- noResultMessages : Messages to display when no results are found.
- resultCol : Number of columns for displaying results.
- showResultMessage : Toggles the display of the results summary message.
- showResults : controls the visibility of the result container.
- searchResponseClass :
Methods
- handleActions : Emits an event when an action is performed on a search result.
- startResultLoader : Initializes the result loader and periodically refreshes search results until completion.
- stopResultLoader : Stops the result loader by clearing the interval timer.
- loadResults : Fetches search results using the
cyphonAPI.search()method and updates the state.