Welcome to TalkGraphics.com
Results 1 to 8 of 8
  1. #1
    Join Date
    Apr 2012
    Location
    SW England
    Posts
    17,746

    Info An Enhanced Local (not Web) Search Utility

    This is still in the cauldron of discovery.

    BACKGROUND
    Xara has not built-in Search Utility.
    Yes - we have web solutions but what of local access to a Print document that is not "published" but is used in a Presentation or emailed?

    APPROACH
    I didn't just want to search for every single word but I wanted Keywords, Key Phrases and their definition or context across the entire document.

    SOLUTION ADOPTED
    I felt I could exploit the pop-up text capability

    At its simplest, Search Terms are added through Web Animation > Mouse-over > Show pop-up text.
    I decided that a Search Term must contain :: to be found.

    PROOF OF CONCEPT
    I used some CSS to establish if I could find text with Title content (pop-up text).
    Code:
    <style>
    span[title*="::"] {
      text-decoration: underline;
      text-decoration-style:dotted;
      text-decoration-color: green;
      text-decoration-skip-ink: auto;
    }
    </style>
    This locates any object with pop-up text containing :: and shows it with a dotted green underline.
    [IE manages a solid underline so Preview is a tad disappointing]

    The rest is code.

    CONSTRUCTION
    I added a Search page at the end of my document with a soft-grouped pair of shapes:
    • Both hold all the required code so these are the transportable items - Copy & Pasted into your own Print Document, Presentation or Vertical Supersite [A Horizontal Supersite sort of works]
    • A Page Transitions Supersite is probably ideal. [In other words, a Conventional Website will not work]
    • I have added https://datatables.net (a jQuery plug-in) to make the Search Box remember its last search results and column position.
    • The soft-grouped Placeholder Code (Head) has the set-up of the HTML Table and the green dotted underline.
    • The Placeholder has HTML code (body) for the singular transparent box that has a Name 'search' and is:
      Code:
      <script>var tableRows = "<table id='searchBox' style='pointer-events: auto;' class='display compact cell-border hover stripe'>";
      	tableRows += "<thead><tr><th>Term</th><th>Description</th><th>Anchor</th><th>Position</th></tr></thead>";
      var searchTerms = document.querySelectorAll('[title*="::"]');
      	for (var i = 0; i < searchTerms.length; ++i) {
      		if ( searchTerms[i].id == "" ) { searchTerms[i].id = searchTerms[i].title.substr(0,2) + i; };
      		tableRows += "<tr>"
      		tableRows += "<td><a href='#" + searchTerms[i].id + "'>" + searchTerms[i].textContent + "</a>" + "</td>"
      		tableRows += "<td>" + searchTerms[i].title + "</td>"
      		tableRows += "<td>" + searchTerms[i].id + "</td>"
      		tableRows += "<td>" + i + "</td>"
      		tableRows += "</tr>";
      	};
      	tableRows += "</table>";
      	
      	document.getElementById("search").innerHTML = tableRows;
      
      
      	$(document).ready(function() {
      		$('#searchBox').DataTable({
      	  "lengthMenu": [[ 10, 20 ], ["Enough", "More than Enough"]]
      	  , colReorder: true
      	  , stateSave: true
      		});
      	} );
          $('#search').css('pointer-events', 'auto');
      	$('#search a').attr('target', '_parent');
      	
      </script>
    • The code adds the HTML rows to a table built up row by row from the Title contents of any object with a ::.

    OPERATION
    Add the Search Box to a bottom page.
    Ensure you use :: in your pop-up text definition.
    The rest is automatic.

    DEMONSTRATOR
    Please run and play with:
    JS-Search Box.xar
    I cribbed these pages form the PDF Help File for v17.0.
    There are some issues with selecting some items, which is how Xara renders PDF into a Xara format.

    WAY AHEAD
    I invite suggestions for development.

    I chose to omit images for the moment but it would be possible to add thumbnails into the table.
    If so, I can visualise the approach to be used in a "native" Shopping Cart.

    Acorn
    Acorn - installed Xara software: Cloud+/Pro+ and most others back through time (to CC's Artworks). Contact for technical remediation/consultancy for your web designs.
    When we provide assistance, your responses are valuable as they benefit the community. TG Nuggets you might like. Report faults: Xara Cloud+/Pro+/Magix Legacy; Xara KB & Chat

  2. #2
    Join Date
    Aug 2000
    Location
    Placitas, New Mexico, USA
    Posts
    41,487

    Default Re: An Enhanced Local (not Web) Search Utility

    How do you see this being used? I have always used Ctrl F which seems to work in most Windows documents.

  3. #3
    Join Date
    Apr 2012
    Location
    SW England
    Posts
    17,746

    Default Re: An Enhanced Local (not Web) Search Utility

    Quote Originally Posted by gwpriester View Post
    How do you see this being used? I have always used Ctrl F which seems to work in most Windows documents.
    Gary, the nearest I can advise is try searching a PDF with Ctrl+F (Find) versus Ctrl+Shift+F (Search).

    You are expecting a level of competence from a viewer understanding you can use Ctrl+F..
    I find Ctrl+F a sledgehammer.

    In the PDF Help Manual, I can Find "Context" 61 times, but I might want the fourteen instance. How do I get there?
    In the PDF Help Manual, I can Search "context" and get a table of 61 hits as well as a short summary of surrounding content and pick the right one and I am there.

    My approach leverages the worth of the returned search content, which is itself searchable.
    My document might be about plants but I Find "carrot" returns nothing but Search "carrot" and I find lots of carrots but no singlualr one; I could Search "vege" and I get vegetables and a description with celeriac, carrots and cabbage, whereupon I realise there is no one carrot to be found but at least now I am in the vegetable patch.

    Yes, Ctrl+F in modern browsers will give you a hit count but you have a lot of clicking and reading to check if that is the thing you are after.

    In the PDF Help Manual, Find/ Search "OCC" and you'll not get the abbreviation OCC anywhere.
    Highlight Online Content Catalogue and add pop-up text: OCC::Abbreviation.
    If there is only Online Content Catalog, highlight it and add pop-up text: OCC: Alternative (American) spelling.

    The PDF Help Manual Search for "colour" is the most telling; all of two hits.
    I would associate Colour - Color::Alternative (American) spelling and then I would know to Search for "color" instead - 1,900 hits.

    Searching is made relevant.

    Acorn
    Acorn - installed Xara software: Cloud+/Pro+ and most others back through time (to CC's Artworks). Contact for technical remediation/consultancy for your web designs.
    When we provide assistance, your responses are valuable as they benefit the community. TG Nuggets you might like. Report faults: Xara Cloud+/Pro+/Magix Legacy; Xara KB & Chat

  4. #4
    Join Date
    Aug 2000
    Location
    Placitas, New Mexico, USA
    Posts
    41,487

    Default Re: An Enhanced Local (not Web) Search Utility

    I dunno Acorn. I just opened a long document and searched for a string of words (Ctrl F) and it came right up.

    I use this method when I am editing a book and I have the author's changes and it works fine for me.

  5. #5
    Join Date
    Aug 2000
    Location
    Harwich, Essex, England
    Posts
    21,895

    Default Re: An Enhanced Local (not Web) Search Utility

    Had a close look at this Acorn and whilst I can follow some of it, I can't follow it alltogether.

    Firstly I previewed your xar file and searched for 'grid'. This returned four results. Good.

    Next I searched for 'optomize' and got no results. Bad.

    I seached the xar file for 'Optimize' found and gave it a mouse-over animation ptomization [Don't you just hate that 'z'].

    It worked, but i set up no anchors and if this word appeared more than once would I need to set up a mouse over animation for every occurance of that word in the document?

    [Don't know why Optomization keeps giving a smiley faced emogee??]
    Egg

    Intel i7 - 4790K Quad Core + 16 GB Ram + NVIDIA Geforce GTX 1660 Graphics Card + MSI Optix Mag321 Curv monitor
    + Samsung 970 EVO Plus 500GB SSD + 232 GB SSD + 250 GB SSD portable drive + ISP = BT + Web Hosting = TSO Host

  6. #6
    Join Date
    Apr 2012
    Location
    SW England
    Posts
    17,746

    Default Re: An Enhanced Local (not Web) Search Utility

    Quote Originally Posted by Egg Bramhill View Post
    Had a close look at this Acorn and whilst I can follow some of it, I can't follow it alltogether.
    Firstly I previewed your xar file and searched for 'grid'. This returned four results. Good.
    Next I searched for 'optomize' and got no results. Bad.
    I seached the xar file for 'Optimize' found and gave it a mouse-over animation ptomization [Don't you just hate that 'z'].
    It worked, but i set up no anchors and if this word appeared more than once would I need to set up a mouse over animation for every occurance of that word in the document?
    [Don't know why Optomization keeps giving a smiley faced emogee??]
    Egg & Gary, head-in-hands Emoji.

    If you add the Search Box to any other file and Preview, you have no entries.
    You, the author, are about to add meta-information into your document to set up searched words in better context than just here's a word and here's the same word again, somewhere else.
    You build up a list of the document's importance to yourself so the reader gains a better experience and understanding.

    If you want every instance of "grid" then you choose the one that is key in you document and add an explanation to its pop-up text.
    Thereafter, and only if it was important, you could use Xara's Find and Replace and for each other instance, just add :: or possibly "Search::grid" or perhaps a more meaningful description around that specific grid's instance..
    Use of the SearchBox for "grid" will then return all grids and you can read all of the descriptions and gain a better insight and location of the grid you were looking for (Star Wars joke).

    Optomize will not be found as it is spelt Optimize.
    Ctrl+F will not find misspellings but SearchBox might if you just use a partial term "opt", "Opt", "mize"; the first two would search out optimise, optimizes, Optimisation.
    If you wanted to ensure a search for "optomize", you could use pop-up text "Alternative misspellings:ptomize, optomise" and highlight one instance of optimize somewhere in your document.

    My premise is you are augmenting the document with concepts, keywords, alternative and context.

    Acorn
    Acorn - installed Xara software: Cloud+/Pro+ and most others back through time (to CC's Artworks). Contact for technical remediation/consultancy for your web designs.
    When we provide assistance, your responses are valuable as they benefit the community. TG Nuggets you might like. Report faults: Xara Cloud+/Pro+/Magix Legacy; Xara KB & Chat

  7. #7
    Join Date
    Aug 2000
    Location
    Placitas, New Mexico, USA
    Posts
    41,487

    Default Re: An Enhanced Local (not Web) Search Utility

    Sorry Acorn. This kind of stuff just sails right past me. Before computers and calculators when I needed to find the center of a layout I was working on, I took a sheet of paper, made tics on the outside edges, and folded the two tics together. The fold was the center. That is how my brain works.

  8. #8
    Join Date
    Apr 2012
    Location
    SW England
    Posts
    17,746

    Default Re: An Enhanced Local (not Web) Search Utility

    Quote Originally Posted by gwpriester View Post
    Sorry Acorn. This kind of stuff just sails right past me. Before computers and calculators when I needed to find the center of a layout I was working on, I took a sheet of paper, made tics on the outside edges, and folded the two tics together. The fold was the center. That is how my brain works.
    understood Gary, but you are quite at home with searching with DuckDuckGo and reading the associated text with your results. Such searching would be a disaster it there was no additional information; my approach offers that depth of detail. Look on it as the same approach to adding Alt text to images: title text to keywords, clever footnotes, guidance to a reader, synonym finder, a tagging mechanism.

    My original concept was for a better web search mechanism but it will work for any Xara-generated electronic media, without accessing the Internet.

    The CSS and JS Libraries do have to be stored within your design locally but that part is trivial.

    It is a utility that allows a designer to be able to enhance a website. I think cmpan1 would understand.

    Acorn

    P.S. I too use the "tic" method, but on the screen. Draw a line between left and right points, Clone and rotate 900: automatic centre.
    Acorn - installed Xara software: Cloud+/Pro+ and most others back through time (to CC's Artworks). Contact for technical remediation/consultancy for your web designs.
    When we provide assistance, your responses are valuable as they benefit the community. TG Nuggets you might like. Report faults: Xara Cloud+/Pro+/Magix Legacy; Xara KB & Chat

 

 

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •