my spec says: It must allow the user to search the data for all records, or for records where the name and/or location fields exactly match values specified by the user.
does that mean if user type "Fred" in name field in gui and click on search, it must return all contractors with "Fred" not "Freddy"? and is case sensitive? currently my program is not case sensitivy and uses .startswith().
thanks in advance
Post by:Mary John
Yes you are right. The result should be Fred alone as spec says exactly match.
My assignment has the same sentence about exact match.
I am not sure about the case sensitive, but I would assume that it should be case sensitive too. anyway lets hear what other have to say...
Post by:John Mattman
These are the instructions in my project.
User Interface instructions
It must allow the user to search the data for all records, or for records where the name and/or location fields exactly match values specified by the user.
/ Returns an array of record numbers that match the specified // criteria. Field n in the database file is described by // criteria[n]. A null value in criteria[n] matches any field // value. A non-null value in criteria[n] matches any field // value that begins with criteria[n]. (For example, "Fred" // matches "Fred" or "Freddy".) public int  find(String  criteria) throws RecordNotFoundException;
My understanding from the above is, if i pass a string "Fred" the query should return records that has name starting with Fred or Freddy.
for example if the data has three records
First Name --------------- Fred Campbell Freddy Jones Fredricks Doe
I would return the three records as they all start with Fred.
Let my interface return three records. but my support method which calls the find(String criteria)method should filter the other two records(Freddy,Fredricks). This way both the requirements are satisfied.
which way is right?
Please correct me if i am not understanding it properly.
[ April 10, 2008: Message edited by: John Mattman ] [ April 10, 2008: Message edited by: John Mattman ]
Post by:fei lin
i think none of the above 3 record should be returned, because it not exact, Campbell is extra. If user search "Fred" only and only "Fred" is returned, please correct me if i am wrong, i am confused
Post by:John Mattman
fei, I am sorry for confusing you. I think it should return only the exact match. I was confused by conflicting instructions being provided. I would change my code to do the exact match.
John [ April 11, 2008: Message edited by: John Mattman ]
Post by:fei lin
thanks guys, i will use exact match,,,, its not user friendly.
Post by:Gilles Marceau
i think there is a misunderstanding in this thread : when you talk about the search feature, remember there is two levels : * the find method of the interface you have to implement. * the search feature of the GUI relying on the first one.
So at first glance, it may seems that your assignment instructions are inconsistent, but if you pay close attention, you'll see that the exact match is required for the GUI, while the "startWith" match is required for the interface. So, this is possible to implement this way (not very efficient, because it implies a post processing, but you have to follow Sun's orders and implement the interface).
Hope it helps,
Post by:Johan den Boer
I interpreted the search as follows. I used the indexOf method to match exactly the values specified by the user in the name and/or location field. So, if the name is 'Company Freddy' or 'Fred's Company' and you are searching for 'Fred' than both records will match, but 'fred' will not.
Barry's not gonna like this. Barry's not gonna like this one bit. What is Barry's deal with tiny ads?
RavenDB is an Open Source NoSQL Database that’s fully transactional (ACID) across your database