question

matthowell-6829 avatar image
0 Votes"
matthowell-6829 asked matthowell-6829 commented

Get the author byline value in search REST api and null if no author is specified

"Author" in a search rest api call returns "_authorbyline" value if a page author is specified, but defaults to the "created by" field if no author is specified.

 /_api/search/query?querytext='SPContentType:"Site Page" AND IsDocument:True AND FileExtension:aspx AND PromotedState:2 AND  Path:xxx'&selectproperties='Author' 

I want this to return null if no author is specified, not the created by field. If I use "AuthorByline", the response is it doesn't exist. It's a site column I believe in the site page content type. I've tried mapping that property to a managed property and using "OData_AuthorByline/Title" which works properly in a SP REST call (ie not search), but neither work.

It seems a no brainer that if you can "hide" the author on a page, that same routine should apply to REST calls. Is there a way to do it?

office-sharepoint-online
· 2
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

@matthowell-6829,
How are things going? Is there any update on your issue?
I am willing to hear from you.

1 Vote 1 ·

@MichaelHan-MSFT Thanks - it's working now. I had mapped a managed property and reindexed library/site but it took a while to return the results. Maybe a timing thing?

0 Votes 0 ·
MichaelHan-MSFT avatar image
1 Vote"
MichaelHan-MSFT answered

Hello, @matthowell-6829,

To achieve this, you need to map the property authorbyline to a managed property of search schema in admin center-> search. Then use that managed property in the search api

Like the bleow:

109310-image.png


If an Answer is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.




image.png (12.8 KiB)
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

matthowell-6829 avatar image
0 Votes"
matthowell-6829 answered matthowell-6829 edited

@MichaelHan-MSFT As I mentioned, the field is already mapped to a predefined managed property in a least one of the sites and still doesn't return authorbyline.

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

MichaelHan-MSFT avatar image
0 Votes"
MichaelHan-MSFT answered

Hello, @matthowell-6829,

After mapping the property authorbyline to a managed property, this will take effect after the next full crawl. So you could reindex the site pages library in library settings-> advanced settings. Then wait some time for the site pages recrawled, the manaded property would return authorbyline. Below is my test result, I used RefineableString00.

110122-image.png

 querytext='SPContentType:"Site Page" AND IsDocument:True AND FileExtension:aspx AND PromotedState:2'&selectproperties='path,Author,RefinableString00'

110104-image.png



image.png (8.2 KiB)
image.png (36.0 KiB)
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.