JoshBritton
Crownpeak (Retired)

Implementing Search G2 Realtime Indexing (Webinar)

Labels (1)
Comments

Hi Team,

This is a good quick start for SearchG2 implementation.

I have a few queries:

1. Kindly, provide the links to the next step of webinars for SearchG2.

2. How to add a field holding the body (syntax)? To view the single page  press release, and not publish the content as webpages.  How to publish the full HTML markup of the Body. (as mentioned at 16:17) What are the uses of full HTML markup, can we insert the same into a new file and view the content as present in crownpeak?

3. Does searchG2 work on Metadata

4. Why keyword search does not word on custom_s filelds.

5. How to enable search for all content & metadata?  is it asset.show?

 

Assuming you have a field in your input form as

Input.ShowTextBox("Field Label", "field_name");

you can add this to the search document by using one of two methods:

1. doc.Add("custom_s_fieldname", "field_name"); // field_name here matches the name of the field in the input.
2. doc.AddFixed("custom_s_fieldname", asset.Raw["field_name"]);

When using Add(), the second parameter is the name of a field specified in the input.aspx. It will automatically grab the contents of the field without having to reference it with asset["field_name"]. The second method AddFixed(), in the example above, essentially does the same thing but we are explicitly using asset.Raw["field_name"], you could also pass in any constructed values here. For example:

string s = "Random Text";
doc.AddFixed("custom_s_fieldname", s);

So this could also contain HTML, although my recommendation would be to keep the html out of the search collection and instead render it client side (sort of like MVC pattern).

The first parameter in both cases will be the field name as stored in the G2 search collection. You can specify any number of arbitrary fields you like but they will need to be prefixed with "custom_*_". The * in this prefix represents the data type. See the table below for the available data types:

 

Field Suffix
Multivalued Suffix
Type
Description
_t
_txt
text_general
Indexed for full-text search so individual words or phrases may be matched.
_s
_ss
string
A string value is indexed as a single unit. This is good for sorting, faceting, and analytics. It’s not good for full-text search.
_i
_is
int
a 32 bit signed integer
_l
_ls
long
a 64 bit signed long
_f
_fs
float
IEEE 32 bit floating point number (single precision)
_d
_ds
double
IEEE 64 bit floating point number (double precision)
_b
_bs
boolean
true or false
_dt
_dts
date
_p
 
location
A lattitude and longitude pair for geo-spatial search

 

There are a few default fields (eg. content, title, metadata_keywords, metadata_description) which do not need to be prefixed with custom_*_ when adding them. You can essentially add any key/value pair required including any additional meta data using the custom_*_ fields.

In regards to your question #4, I'm not sure I quite understand your question but by default when you do a search using the ?q= parameter it will search the default fields (eg. title, content, metadata_keywords, etc...). You can search alternate fields by altering your query. For example, you could use ?q=custom_s_fieldname:'search phrase'. Please Google Solr Search Syntax for more details on making queries. The back end of G2 Search is essentially using Solr.

As for enabling search for all content, as mentioned above, by default G2 search would search the default fields if you only use ?q= but you can alter the syntax to search any other fields as needed. If you would like to make your queries simple, one trick would be to throw all of your content into the default "content" field (eg. doc.AddFixed("content", "string containing all content"); ) and use another field for display purposes instead. That way your queries would only require a simple ?q= paremter and when rendering the search results page, you could display a separate field (eg. custom_s_displaytext).

Depending on how your templates are setup, asset.Show() may or may not include contents and meta data as asset.Show() just renders the output.aspx of the template. So depending on how that's implemented it would or would not contain all content and meta data. However, as I mentioned, you would probably want to keep the HTML out of search to have a good separation of concerns as that would probably be better coding practice. Depending on the implementation, using asset.Show() would most likely include the HTML.

Hope this helps.

Regards,
Ed

@eunice-richard, I am researching the availability of the additional webinars.

All the best, Denise

Labels

Have an idea

Have an idea to improve DXM?

Let us know !

Submit an idea

Can't find what you are looking for?

Find Answers

Search our DXM Forum to find answers to questions asked by other DXM users.

Ask a Question

No luck? Ask a question. Our Product and Support teams are monitoring the Forum and typically respond within 48 hours.

Ask a Question