Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

make ./htm/search.htm more functional #65

Open
ericleasemorgan opened this issue May 28, 2020 · 18 comments
Open

make ./htm/search.htm more functional #65

ericleasemorgan opened this issue May 28, 2020 · 18 comments
Assignees
Labels
enhancement New feature or request

Comments

@ericleasemorgan
Copy link
Owner

The Reader supports a rudimentary search interface found at ./htm/search.htm Change this file so it is more usable. For example, provide some instructions. Provide some graphic design. Ensure the query box is retained when results are returned. Hyperlink results to their corresponding files in ./cache and ./txt

This file ./htm/search.htm is dynamically created by the underlying Reader software found at https://github.com/ericleasemorgan/reader/blob/master/bin/carrel2search.pl Once this task is completed, we will want to see about incorporating it into that file, and doing so will probably only mean editing a template: https://github.com/ericleasemorgan/reader/blob/master/etc/template-search.htm

@mcarro10
Copy link
Collaborator

mcarro10 commented Jun 1, 2020

PROCESS_1dd0055f-d886-4284-a911-2e86ead7f195.zip
updated directory with functional search.htm file

@ericleasemorgan
Copy link
Owner Author

You did what you said you were going to do when you said you were going to do it. Thank you. The result is a whole lot better than what I could have done. Javascript is not my forte.

And alas, there are a few enhancements I'd like you to do.* Listed in no priority order, they include:

  1. add title - Every returned record includes the hyperlinked phrase "Text File". Please replace "Text File" with the title of the record. The hyperlinking works as expected. Thank you.

  2. get results - I expect each & every word in the JSON stream to be indexed, and search results only seem to return when I paste a value into the search box. When I type a value, like "Achilles" into the search box, I get zero results. But when I paste a value into the search box, then I often get results as expected. I suspect this a Javascripty thing. I don't know. Mysterious. I have tried this with both Safari and Chrome. In short, sometimes I get results and sometimes I don't.

Now, here's a difficult question. How large, measured in megabytes, do you think the file ./htm/search.htm can be before performance will degrade? In other words, what is the practical size limit of ./htm/search.htm?

  1. edit template - The file ./htm/search.htm gets created by a script:

https://github.com/ericleasemorgan/reader/blob/master/bin/carrel2search.pl

The script reads an underlying database, extracts a few values, munges the values into a JSON stream, opens a template, and does a find/replace in the template, and outputs the result to ./htm/search.htm Here is the template:

https://github.com/ericleasemorgan/reader/blob/master/etc/template-search.htm

I don't expect you to edit ./bin/carrel2search.pl, but please edit ./etc/template-search.htm so the script can output something that looks like what you sent me.

Once you look at ./bin/carrel2search.pl maybe you can give me an idea of the practical limit of ./htm/search.htm is.

Okay? 'Make sense? If so, then when do you think you can "finish" this work?*

  • "Software is never done. If it where, then it would be called 'hardware'."

@mcarro10
Copy link
Collaborator

mcarro10 commented Jun 2, 2020 via email

@nkmeyers
Copy link
Collaborator

nkmeyers commented Jun 2, 2020

@mcarro10 good luck with move out - hope it goes ok! Send a pic from campus I haven't seen it since mid-march! Same for you?

@nkmeyers nkmeyers added the enhancement New feature or request label Jun 2, 2020
@ericleasemorgan
Copy link
Owner Author

@mcarro10 Thank you for the update. And we look forward to more good hacks of yours soon. Be safe.

@mcarro10
Copy link
Collaborator

mcarro10 commented Jun 5, 2020

PROCESS_1dd0055f-d886-4284-a911-2e86ead7f195 2.zip

Improved search.htm file - includes titles with results and I think that the search function is working properly for all entries (and can now use enter key as well as button.)

@ericleasemorgan
Copy link
Owner Author

ericleasemorgan commented Jun 5, 2020 via email

@ericleasemorgan
Copy link
Owner Author

ericleasemorgan commented Jun 5, 2020 via email

@nkmeyers
Copy link
Collaborator

nkmeyers commented Jun 5, 2020

@mcarro10 thanks, great to see some search functionality inside a carrel! here's mine looking for aridity (now I have camels!)
image

@mcarro10
Copy link
Collaborator

mcarro10 commented Jun 5, 2020

@mcarro10 thanks, great to see some search functionality inside a carrel! here's mine looking for aridity (now I have camels!)
image

Great!!! Thank you!

@mcarro10
Copy link
Collaborator

mcarro10 commented Jun 5, 2020

This worked very well. I changed the internal hyperlink from cache to txt. I then added a token ##JSON## so each rendition of the page can be customized to each carrel. For example, try: https://cord.distantreader.org/carrels/president-trump/htm/search.htm Search for "trump". How do you feel about your code? How do you think it can be improved? We might want to add some additional fields, like a URL a DOI or authors. More importantly, how well do you think it can scale? How many documents to you think it can contain before it becomes too cumbersome to use?

-- Eric

I think that in terms of basic functionality, it seems to work well. I think that it would certainly be good to add additional fields, and I can definitely work on that through the weekend and into the beginning of next week, as well as any other features that you would like to see. In terms of scaling, I have tried to play around with it a bit to determine what the maximize load would be, but I have not been able to determine a limit yet. I will continue to test this - I am sorry for not having a clear answer on this yet.

@ericleasemorgan
Copy link
Owner Author

ericleasemorgan commented Jun 8, 2020 via email

@ericleasemorgan
Copy link
Owner Author

ericleasemorgan commented Jun 8, 2020 via email

@ericleasemorgan
Copy link
Owner Author

ericleasemorgan commented Jun 8, 2020 via email

@mcarro10
Copy link
Collaborator

mcarro10 commented Jun 8, 2020 via email

@ericleasemorgan
Copy link
Owner Author

ericleasemorgan commented Jun 8, 2020 via email

@mcarro10
Copy link
Collaborator

mcarro10 commented Jun 8, 2020 via email

@ericleasemorgan
Copy link
Owner Author

ericleasemorgan commented Jun 8, 2020 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants