File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Exactly match searching in URLYBird

 
Zhixiong Pan
Ranch Hand
Posts: 239
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,
Comments in assignment say
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.
My opinion is searchAll will call read() with all recNo. Tow JTextField instances will be created and added to client UI. So search means both the two conditions name and location should be satisfied. When instance which stands for name is blank, I will search for records only exactly match location fields values. It is similar when instance which stands for location is blank. When both of them are blank, search now equals the meaning of searchAll. At first I want to utilize find in Data to realize search. Howerver, comments regarding find say
//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".)
.
So can you see the collision here? Then I decide to overwrite find, with passed parameters name (String ) and location (String) ,and this time find will do exactly matching. How do you think so?
 
Ed Tse
Ranch Hand
Posts: 183
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't see the collusion. Please explain your concern more clearly?

I also was wondering if we need 2 Textfield for search criteria.
[ March 26, 2006: Message edited by: Ed Tse ]
 
LianGuang Wang
Greenhorn
Posts: 11
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i have the same doubt!but i prefer to exec another match in the results of the find in the initial interface!who can give a clear answer?
 
Zhixiong Pan
Ranch Hand
Posts: 239
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Hot,
Your way
to exec another match in the results of the find in the initial interface
is better than mine. I think we should not add any method to Data which implements DB. Also waiting for an clear explanation.
 
Andrew Monkhouse
author and jackaroo
Marshal Commander
Pie
Posts: 11831
181
C++ Firefox Browser IntelliJ IDE Java Mac Oracle
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Zhixiong,

Consider this from the perspective of a large company developing this program:
  • The server side staff have to create a generic search facility that will do "starts-with" searching.


  • They may not be aware of the GUI programmer's requirements, or they may be aware of two (or more) different groups who all want to do searches (so they are creating a generic interface). We don't know. All we know is that the server programmers have been told to create a server-side "starts-with" search.

  • The GUI programming team have been told to make an application that is very specific to the needs of the users who will be using the system.


  • So the GUI programmers will be developing a client-side exact-match system.

    This has nothing to do with how the search facility on the server-side works.When you look at it like that, it might be possible to see that there is no real problem: what you are seeing as a problem is only because you are trying to develop one application rather than considering from the view that there are two separate applications (client and server).

    To further divorce the concept between performing a search and displaying data, the search method does not return records - it returns record numbers. You have to retrieve the records based on the numbers in a separate step. So you would presumably be validating that the records still matched anyway (otherwise the records could change between when you complete the search and when you retrieve the record).

    Also you have even been told that there are other applications working with the data, so having a more generic API than you really need that has methods you don't need should come as no surprise.

    Regards, Andrew
     
    Zhixiong Pan
    Ranch Hand
    Posts: 239
    • 0
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Hi Andrew,
    Your replies have always helped me a lot.
    what you are seeing as a problem is only because you are trying to develop one application rather than considering from the view that there are two separate applications (client and server).

    That is my key problem.So my task now is to realize exact matching in client using the result of find in server.
    You have to retrieve the records based on the numbers in a separate step.So you would presumably be validating that the records still matched anyway (otherwise the records could change between when you complete the search and when you retrieve the record).

    This is the principle my search must take into account.And the result will be certain object and certain scope be synchronized.
    However I still wonder to know the form how user send their searching infor, what JComponent best suite this requirement.Thanks a lot.
     
    Carlo Spelgatti
    Greenhorn
    Posts: 10
    • 0
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Thank you Andrew.

    I was also thinking about this and decided to do the exact matching in the client, but I forgot, that the records I found first could have changed meanwhile.

    regards, carlo
     
    Anna Hays
    Ranch Hand
    Posts: 131
    • 0
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    I didn't do an exact match search on the client. However, I stated that since searching the prefix will return all the exact matches, it satisfy the requirements in the spec of performing an exact match search. My reason is that the user will have a lot to type and have to type careful if you have to type in the exact name and/or location. What do you think about this?

    Thanks.
     
    Zhixiong Pan
    Ranch Hand
    Posts: 239
    • 0
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Hi Anna,
    My reason is that the user will have a lot to type and have to type careful if you have to type in the exact name and/or location
    But I think it will not add much complexity, cause only name and location execute exact matching. Why you risk breaking the requirement? Am I right or wrong?
     
    • Post Reply
    • Bookmark Topic Watch Topic
    • New Topic