Click here to Skip to main content
15,887,683 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I have lot of entities which contain thousands of records, with diverse values like some have ranges using BETWEEN numbers,some with IN variable having multiple values in it, some with LIKE variable containing multiple values of different data types such as integer, string & decimal. For example - a typical record looks like -

A = New | Code = IN 101,102,103 | Values = LIKE A*,B*,C* | Quality = BETWEEN 1,9 |
Test = IN A


If i get an input for the fields - A,Code, Values & Quality per above I need to return the corresponding Test field for all the matching records. The input can be per below:

A = New , Code = 102, Values = Alpha, Quality = 8.2

Given the above I was thinking about using pattern matching algorithms to be used to identify the matching records. Please do suggest which algorithm will fit the bill to correctly identify a given record(s) based on the set of values provided.

What I have tried:

Given the above I was thinking about using pattern matching algorithms to be used to identify the matching records. Also to hash the inputs to be used as a lookup when the inputs are to be searched for.
Posted
Updated 13-Feb-17 11:03am

1 solution

Quote:
Please do suggest which algorithm will fit the bill to correctly identify a given record(s) based on the set of values provided.

You are in the worst possible situation, the flat text data imply the use of brut force. The name of fields in every records make it even worse the CSV format.
The only optimization you can expect is to first check the field that will best filter the records. But it will not change much the time to process the data.
So:
1) read all lines, no optimization
2) for each line, split on comma, no optimization
3) for each field, split on equal, modest optimization possible depending on filter.
 
Share this answer
 
v3

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900